************************************************************ * Program: C:\NHANES\LabelFormat.sas * * Proposal: Label and format dervied variables * ************************************************************; libname lib "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\datasets"*/ /*see program AppendMerge_RegroupRecode.sas*/ /*User defined format*/ proc format; value yesno 1='Yes' 2='No'; value age 1='Age 20-39' 2='Age 40-59' 3='Age 60+'; value race 1='NH white' 2='NH black' 3='Mexican American' 4='Other race/ethn'; run; /*Assign user defined format to derived variables, label new variable*/ data demo_BP4; set lib.demo_BP3; format age3cat age. raceth race. SBP140 DBP90 HBP_trt HBP HLP_lab HLP_trt HLP yesno.; label age3cat='Age 3 categories' raceth='Race/ethn 4 categories' mean_SBP='Mean of SBP' mean_DBP='Mean of DBP' SBP140='SBP>=140 mmHg' DBP90='DBP>=90 mmHg' HBP_trt='Hypertension treatment' HBP='Hypertension' HLP_lab='Cholesterol>=240 mg/dl' HLP_trt='Hyperlipidemics treatment' HLP='Hyperlipidemics'; run;