webuse nhanes2 // use Stata's online dataset from NHANES describe // get an overview of the dataset codebook region // look at details for the categorical variable "region" browse sex race age if region==1 // look at all the observations for sex, race, and age that are in region 1 bysort sex: sum bpsystol // for each category of sex, summarize systolic blood pressure bysort sex: sum bpsystol if region==1 // for each category of sex, summarize systolic bp for those in region 1 bysort region: sum bpsystol if sex==1 // for each category of region, summarize systolic bp for males bysort region: sum bpsystol if sex==2 // for each category of region, summarize systolic bp for females gsort +height // sort "height" variable in ascending order browse height // look at results of above gsort -height // sort "height" variable in descending order list in 1/10 // this is the corrected version - lists all the values of all the variables for the first 10 observations list if height==200 // lists all the values of all the variables for those with a height of 200 cm list bpsystol bpdiast if height>190 // lists the values of "bpsystol" and "bpdiast" for those with a height > 150 cm inspect age height // inspect the numerical variables "age" and "height" bysort sex: inspect height // for each category of sex, inspect the "height" variable inspect height if age >50 // inspect height for those >5 export delimited using "/Users/amandairish/Desktop/Biostat 212/nhanes data.csv", replace // export data as a .csv file import delimited using "/Users/amandairish/Desktop/Biostat 212/nhanes data.csv", clear // import a .csv file ** Additional material: further specifying observations with & and | tab region sex if height>150 & weight <200 // cross-tabulation of region and sex for those with height >150 cm and weight <200 kg sum bpsystol if age==30 | age==50 // summarize systolic bp for those of age 30 and those of age 50