************************************************************ * Program: C:\NHANES\CleanRecode_CheckRecodes.sas * * Proposal: Check variable recodes * ************************************************************; libname NH "C:\your_dir"; /*change the name of the directory folder to the location that you saved your downloaded dataset from the sample code and dataset downloads module: for example "c:\nhanes\data"*/ /*Using proc freq cross table for original categorical variables*/ proc freq data=NH.demo_BP3; where ridstatr=2 and ridageyr>=20; table raceth*ridreth1/list missing; table HBP_trt*BPQ020*BPQ050a HBP*HBP_trt*SBP140*DBP90/list missing; table HLP_trt*BPQ080*BPQ100d HLP*HLP_trt*HLP_lab/list missing; title 'Check regroup/recode/definitions categorical variables'; run; /*Using proc means for original continuous variables*/ proc means data=NH.demo_BP3 N min max; where ridstatr=2 and ridageyr>=20; var ridageyr; class age3cat; title 'Check if each age category is in the corrected age range'; proc means data=NH.demo_BP3 N min max; where ridstatr=2 and ridageyr>=20; var mean_SBP; class SBP140; title 'Check if SBP >=140 is defined correctly'; proc means data=NH.demo_BP3 N min max; where ridstatr=2 and ridageyr>=20; var mean_DBP; class DBP90; title 'Check if DBP >=90 is defined correctly'; proc means data=NH.demo_BP3 N min max; where ridstatr=2 and ridageyr>=20; var lbxtc; class HLP_lab; title 'Check if TC>=240 is defined correctly'; run;