我遇到的问题包括我的proc surveyfreq中的域声明,未经调整的proc surveylogistic和经过调整的proc surveylogistic程序。
我使用了在SAS社区网站上找到的代码,但是我不断收到错误消息。我正在尝试为年龄类别1和2设置这些程序的范围。年龄类别1 =“ 18-49岁”,年龄类别2 =“ 50岁及以上”。我只从分析中排除一个年龄类别,年龄类别= 0,即0-17岁。在得知使用Surveyfreq和Surveylogistic程序时无法使用by或where语句后,我转向了域语句。
任何帮助将不胜感激!
请在下面找到我的代码:
调查频率:
*run proc surveyfreq for demographic variables;
proc surveyfreq data=GSS1;
weight wtssnr;
tables agecategory*(sex marital sexornt racecen1 racecen2 racecen3 degree wrkstat income16 region);
STRATUM vstrat;
CLUSTER vpsu;
FORMAT degree degree. wrkstat wrkstat. income16 totalfamilyincome. regionregion. agecategory agecategory. marital marital. sex sex. racecen1 racecen1mention. racecen2 racecen2mention. racecen3 racecen3mention. sexornt sexornt.;
run;
未调整的测量物流程序
*Step 9: Unadjusted logistic regression using proc surveylogistic;
proc surveylogistic data=GSS1;
class agecategory/param=ref;
model condom (event= 'Used last time') = agecategory/df=infinity;
strata vstrat;
cluster vpsu;
weight wtssnr;
format condom condom. agecategory agecategory.;
run;
调整后的测绘程序
*Step 13: Run an adjusted logistic regression model using proc surveylogistic;
proc surveylogistic data=GSS1;
class condom agecategory marital evidu evcrack partners sexfreq hivtest sexornt racecen1 degree region income16 wrkstat/param=ref;
model condom (event='Used last time')=agecategory marital evidu evcrack partners sexfreq hivtest sexornt racecen1 degree region income16 wrkstat/link=glogit df=infinity;
STRATUM vstrat;
CLUSTER vpsu;
weight wtssnr;
FORMAT condom condom. sex sex. agecategory agecategory. marital marital. evidu evidu. idu30 idu30days. evcrack evcrack. crack30 crack30lastuse. partners partners. sexfreq sexfreq. hivtest hivtest. sexornt sexornt. racecen1 racecen1mention. degree degree. region region. income16 totalfamilyincome. wrkstat wrkstat.;
run;