******************************************************************************* * Program: C:\NHANES\LogisticRegression_SAS_9.2.sas * * Proposal: Logistic regression analysis with multiple independent variables - * SAS Survey procedure * ******************************************************************************; *Save tutorial dataset in a folder on your C drive to read into SAS; LIBNAME NH "C:\NHANES\DATA"; OPTIONS NODATE NOCENTER; options ls=72; proc format; VALUE sexfmt 1 = 'Male' 2 = 'Female' ; VALUE agefmt 1='20-39 yrs' 2='40-59 yrs' 3='60 + yrs'; VALUE bpfmt 1='hypertension' 0='no hypertension' ; VALUE chfmt 1='high cholesterol' 0='not high cholesterol' ; VALUE bmifmt 1='BMI<25' 2='25<=BMI<30' 3='BMI>=30' ; run; data analysis_data; set NH.analysis_data; if ridstatr=2; *all mec examined data; if ridageyr >= 20 then sel=1; *else sel=2; *create an indicator of hypertension based on blood pressure and medication; if (bpxsar >= 140 or bpxdar >= 90 or bpq050a = 1) then Hyper = 1; else if (bpxsar ne . and bpxdar ne .) then Hyper = 0; *create an indicator of high cholesterol based on total cholesterol and medication; if (lbxtc>=240 or bpq100d = 1) then HiChol = 1; else if (lbxtc ne . ) then HiChol = 0; *create bmi groups; if 0<=bmxbmi<25 then bmigrp=1; else if 25<=bmxbmi<30 then bmigrp=2; else if bmxbmi>=30 then bmigrp=3; *create age groups; if 20<=ridageyr<40 then age=1; else if 40<=ridageyr<60 then age=2; else if ridageyr>=60 then age=3; *create log of fasting triglycerides; logtrig=log(lbxtr); label hyper='Indicates if have hypertension' HiChol='Indicates if have High Cholesterol' BMIGRP='BMI groups, lean, overweight, obese' Riagendr = 'Gender' Age = 'Age Group'; run; /*proc freq data=analysis_data; tables sel; run;*/ PROC SURVEYLOGISTIC DATA = Analysis_Data nomcar; /* can add "noprint" option to suppress printing if using ods statement*/ STRATA sdmvstra; CLUSTER sdmvpsu; WEIGHT wtsaf4yr; DOMAIN sel; CLASS age (PARAM=REF REF='40-59 yrs') riagendr (PARAM=REF REF='Female') hichol (PARAM=REF REF='high cholesterol') bmigrp (PARAM=REF REF='25<=BMI<30'); MODEL hyper (desc)=age riagendr hichol bmigrp logtrig/clparm vadjust=none; *ods output DomainSummary=Domain_Summary OddsRatios=Odds_Ratios ParameterEstimates=Estimates; title "Multiple Logistic Regression: Odds of Hypertension"; format age agefmt. riagendr sexfmt. hichol chfmt. bmigrp bmifmt.; run; /*print esimates savee from ods statements *proc print data=WORK.ESTIMATES; where sel=1; run; *proc print data=WORK.ODDS_RATIOS; where sel=1; run; *proc print data=WORK.DOMAIN_SUMMARY; where sel=1; run;*/ /*note: By default, PROC SURVEYLOGISTIC displays information for the entire data set If there is a DOMAIN statement, PROC SURVEYLOGISTIC also displays information for the domain data set. SAS 9.2 Documentation SAS/STAT(R) 9.2 User's Guide NOTE: NOMCAR requests that the procedure treat missing values in the variance computation as not missing completely at random (NOMCAR) for Taylor series variance estimation. When you specify the NOMCAR option, PROC SURVEYLOGISTIC computes variance estimates by analyzing the nonmissing values as a domain or subpopulation, where the entire population includes both nonmissing and missing domains. See the section Missing Values for more details. By default, PROC SURVEYLOGISTIC completely excludes an observation from analysis if that observation has a missing value, unless you specify the MISSING option. Note that the NOMCAR option has no effect on a classification variable when you specify the MISSING option, which treats missing values as a valid nonmissing level. The NOMCAR option applies only to Taylor series variance estimation. The replication methods, which you request with the VARMETHOD=BRR and VARMETHOD=JACKKNIFE options, do not use the NOMCAR option. VADJUST=DF VADJUST=MOREL <(Morel-options)> VADJUST=NONE specifies an adjustment to the variance estimation for the regression coefficients. By default, PROC SURVEYLOGISTIC uses the degrees of freedom adjustment VADJUST=DF. If you do not want to use any variance adjustment, you can specify the VADJUST=NONE option. You can specify the VADJUST=MOREL option for the variance adjustment proposed by Morel (1989). You can specify the following Morel-options within parentheses after the VADJUST=MOREL option. */