************************************************************************ * Program: C:\NHANES\.sas * * Proposal: * ************************************************************************; LIBNAME NH "C:\NHANES\DATA"; OPTIONS NODATE NOCENTER; options ls=72; proc format; VALUE sexfmt 1 = 'Male' 2 = 'Female' ; VALUE racefmt 1 = 'NH White' 2 = 'NH Black' 3 = 'Mexican American' 4 = 'Other' ; VALUE agefmt 1 = '20-39' 2 = '40-59' 3 = '60+' ; VALUE selfmt 1= 'Age ge 20' 2= 'Age lt 20'; run; data ANALYSIS_DATA; set NH.ANALYSIS_DATA; if ridstatr = 2; ***examined ; /*variable created for study subpopulation of interest:used on domain statement for SAS Survey procedure*/ if ridageyr ge 20 then sel=1; else sel=2; age = .; if 20 LE ridageyr LE 39 then age=1; if 40 LE ridageyr LE 59 then age=2; if ridageyr GE 60 then age=3; race=.; if ridreth1=3 then race=1; if ridreth1=4 then race=2; if ridreth1=1 then race=3; if ridreth1=2 or ridreth1=5 then race=4; LABEL age = 'AGE GROUP' race = 'Race Ethnicity' riagendr = 'Gender' sel = 'Subpop: 1=age ge 20 2=age lt 20' ; RUN; ods trace on; proc surveymeans data=ANALYSIS_DATA nobs mean stderr; cluster sdmvpsu; stratum sdmvstra; class riagendr age; var lbxtc; weight wtmec4yr; domain sel sel*riagendr*age; format sel selfmt. riagendr sexfmt. age agefmt. lbxtc f6.2; ods output domain(match_all)=domain; /*output dataset(s)= # of request on domain statement: in this example*/ /*there are two requests 'sel'(domain) and 'sel*riagendr*age'(domain1)*/ RUN; data all; set domain domain1; if sel='Age ge 20'; /*only keep statistics for subpop 20 years and older*/ run; proc print noobs data=all split='/'; var riagendr age N Mean stderr; format N 5.0 Mean 6.2 StdErr 5.3; label N='Sample'/'Size' stderr='Standard'/'error'/'of the'/'mean' mean='Mean' stderr='Standard'/'error'/'of the'/'Mean'; title1 'Mean serum total cholesterol of adults 20 years and older, 1999-2002'; run;