/*******************************************************************/ /* Program: workshop.example.sas */ /* Date: October 2007 */ /*******************************************************************/ Filename cpsfeb03 "cpsfeb03.dat" lrecl=1384; Filename cpsjun03 "cpsjun03.dat" lrecl=1384; Filename cpsnov03 "cpsnov03.dat" lrecl=1384; Proc Format; Value PESexF 1 = "Male" 2 = "Female" ; Value AgeGrpF 1 = "18-24" 2 = "25-44" 3 = "45-64" 4 = "65+" ; Value SmokStF 1,4 = "Never/Former" 2,3 = "Current" ; %Macro ReadData(survey); Data CPS&survey; Infile CPS&survey; Input @0016 HRMonth 2. @0018 HRYear4 4. @0093 GESTFIPS 2. /* State (FIPS) Variable */ @0122 PRTAge 2. @0129 PESex 2. @0137 PEEduca 2. @0139 PRDTRace 2. @0141 PRDTHSP 2. @0161 PRPERTYP 2. @0879 PEA1 2. @0883 PEA3 2. @1347 Intrview 2. @1351 SmokStat 2. @1357 PRS64 2. @1363 PWNRWgt 10. @1373 PWSRWgt 10.; If PRPerTyp=2; /* Adult Civilian Household Member */ If PRTAge>17; /* Ages 18 and over */ If Intrview=1; /* Supplement Interview */ If PEA1 In (1,2) & PEA3 Not In (-9,-3,-2); /* Exclude Don't Know, Refused, No Response */ PWNRWgt=PWNRWgt/10000; If PRS64=1 THen PWSRWgt=PWSRWgt/10000; %Mend; %ReadData(feb03); Run; %ReadData(jun03); Run; %ReadData(nov03); Run; Data CPS03; Set CPSfeb03 CPSjun03 CPSnov03; PWNRWgt=PWNRWgt/3; If PRS64=1 Then PWSRWgt=PWSRWgt/3; If (18<=PrtAge<=24) Then AgeGrp=1; Else If (25<=PrtAge<=44) Then AgeGrp=2; Else If (45<=PrtAge<=64) Then AgeGrp=3; Else If (PrtAge>64) Then AgeGrp=4; Format AgeGrp AgeGrpF. PESex PESexF. SmokStat SmokStF.; Label HRMonth = "Month of Interview" HRYear4 = "Year of Interview" GESTFIPS = "Federal Information Processing Standards State Code" PRTAge = "Persons Age" PESex = "Gender" PEEduca = "Highest Level of School Completed" PRDTRace = "Race" PRDTHSP = "Detailed Hispanic Origin Group" PRPERTYP = "Type of Person Record Recode" PEA1 = "Smoked at Least 100 Cigarette in Entire Life" PEA3 = "Now Smokes Cigarettes Every Day, Some Days or Not at All" Intrview = "Interview Status Recode" SmokStat = "Smoker Recode" PRS64 = "Who is Responding for the Supplement" PWNRWgt = "Nonresponse Weight" PWSRWgt = "Self Response Weight" AgeGrp = "Age Group"; Run; Proc Tabulate Data=CPS03; Title1 "2003 Tobacco Use Special Cessation Supplement to The Current Population Survey"; Title2 "February, June and November"; Title3 "Interviewed, Adults, Ages 18 and Over"; Title4 "Self and Proxy Respondents"; Title6 "Current Cigarette Smoking Status By Gender and Age Group"; Class PESex AgeGrp SmokStat; Var PWNRWgt; Table All="Total" PESex AgeGrp, (SmokStat All="Total")* (N="Sample"*F=Comma7. PWNRWgt=""*(Sum="Population"*F=Comma12. PctSum="Percent"*F=7.2))/RTS=11; Run; Proc Tabulate Data=CPS03; Title4 "Self Respondents Only"; Title6 "Current Cigarette Smoking Status By Gender and Age Group"; Where PRS64=1; Class PESex AgeGrp SmokStat; Var PWSRWgt; Table All="Total" PESex AgeGrp, (SmokStat All="Total")* (N="Sample"*F=Comma7. PWSRWgt=""*(Sum="Population"*F=Comma12. PctSum="Percent"*F=7.2))/RTS=11; Run; 2003 Tobacco Use Special Cessation Supplement to The Current Population Survey February, June and November Interviewed, Adults, Ages 18 and Over Self and Proxy Respondents Current Cigarette Smoking Status By Gender and Age Group -------------------------------------------------------------------------------------------------- | | Smoker Recode | | | |---------------------------------------------------------| | | | Never/Former | Current | Total | | |----------------------------+----------------------------+----------------------------| | |Sample | Population |Percent|Sample | Population |Percent|Sample | Population |Percent| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |Total |190,443| 172,325,312| 81.62| 43,831| 38,802,077| 18.38|234,274| 211,127,389| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |Gender | | | | | | | | | | |---------| | | | | | | | | | |Male | 87,190| 80,291,768| 79.31| 22,851| 20,952,265| 20.69|110,041| 101,244,033| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |Female |103,253| 92,033,544| 83.76| 20,980| 17,849,813| 16.24|124,233| 109,883,356| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |Age Group| | | | | | | | | | |---------| | | | | | | | | | |18-24 | 20,938| 21,718,055| 80.04| 5,524| 5,415,382| 19.96| 26,462| 27,133,437| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |25-44 | 68,898| 64,920,654| 78.97| 19,362| 17,291,823| 21.03| 88,260| 82,212,477| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |45-64 | 62,694| 54,469,001| 80.40| 15,482| 13,281,816| 19.60| 78,176| 67,750,818| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |65+ | 37,913| 31,217,602| 91.73| 3,463| 2,813,056| 8.27| 41,376| 34,030,658| 100.00| -------------------------------------------------------------------------------------------------- 2003 Tobacco Use Special Cessation Supplement to The Current Population Survey February, June and November Interviewed, Adults, Ages 18 and Over Self Respondents Only Current Cigarette Smoking Status By Gender and Age Group -------------------------------------------------------------------------------------------------- | | Smoker Recode | | | |---------------------------------------------------------| | | | Never/Former | Current | Total | | |----------------------------+----------------------------+----------------------------| | |Sample | Population |Percent|Sample | Population |Percent|Sample | Population |Percent| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |Total |148,359| 171,535,094| 81.10| 34,644| 39,967,679| 18.90|183,003| 211,502,773| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |Gender | | | | | | | | | | |---------| | | | | | | | | | |Male | 62,982| 80,036,782| 78.84| 16,640| 21,475,837| 21.16| 79,622| 101,512,620| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |Female | 85,377| 91,498,311| 83.19| 18,004| 18,491,842| 16.81|103,381| 109,990,154| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |Age Group| | | | | | | | | | |---------| | | | | | | | | | |18-24 | 12,526| 20,996,856| 77.50| 3,869| 6,096,211| 22.50| 16,395| 27,093,066| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |25-44 | 53,945| 65,015,572| 78.86| 15,302| 17,428,592| 21.14| 69,247| 82,444,164| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |45-64 | 49,721| 54,268,434| 79.94| 12,516| 13,619,680| 20.06| 62,237| 67,888,113| 100.00| |---------+-------+------------+-------+-------+------------+-------+-------+------------+-------| |65+ | 32,167| 31,254,232| 91.72| 2,957| 2,823,197| 8.28| 35,124| 34,077,430| 100.00| -------------------------------------------------------------------------------------------------- /*******************************************************************/ /* Program: workshop.example.reps.sas */ /* Date: October 2007 */ /*******************************************************************/ Filename cpsfeb03 "cpsfeb03.dat" lrecl=1384; Filename cpsjun03 "cpsjun03.dat" lrecl=1384; Filename cpsnov03 "cpsnov03.dat" lrecl=1384; Filename repfeb03 "feb03nrrep.fixed_15yr.dat"; Filename repjun03 "jun03nrrep.fixed_15yr.dat"; Filename repnov03 "nov03nrrep.fixed_15yr.dat"; Proc Format; Value PESexF 1 = "Male" 2 = "Female" ; Value AgeGrpF 1 = "18-24" 2 = "25-44" 3 = "45-64" 4 = "65+" ; Value CurrentF 1 = "Yes" 2 = "No" ; %Macro ReadData(survey); Data CPS&survey; Infile CPS&survey; Input @0016 HRMonth 2. @0018 HRYear4 4. @0093 GESTFIPS 2. @0122 PRTAge 2. @0129 PESex 2. @0161 PRPERTYP 2. @0815 QstNum 5. @0820 OccurNum 2. @0879 PEA1 2. @0883 PEA3 2. @1347 Intrview 2. @1351 SmokStat 2.; If PRPerTyp=2; /* Adult Civilian Household Member */ If PRTAge>17; /* Ages 18 and over */ If Intrview=1; /* Supplement Interview */ If PEA1 In (1,2) & PEA3 Not In (-9,-3,-2); /* Exclude Don't Know, Refused, No Response */ Data Rep&Survey; Infile Rep&Survey Missover; Input @001 QstNum 5. @007 OccurNum 2. @045 SmplWgt 11.4 @056 (RepWgt01-RepWgt04) (11.4) / @001 (RepWgt05-RepWgt11) (11.4) / @001 (RepWgt12-RepWgt18) (11.4) / @001 (RepWgt19-RepWgt25) (11.4) / @001 (RepWgt26-RepWgt32) (11.4) / @001 (RepWgt33-RepWgt39) (11.4) / @001 (RepWgt40-RepWgt46) (11.4) / @001 (RepWgt47-RepWgt53) (11.4) / @001 (RepWgt54-RepWgt60) (11.4) / @001 (RepWgt61-RepWgt67) (11.4) / @001 (RepWgt68-RepWgt74) (11.4) / @001 (RepWgt75-RepWgt80) (11.4); If SmplWgt=0 & (RepWgt01=0 | RepWgt01=.) Then Delete; Proc Sort Data=CPS&Survey; By QstNum OccurNum; Proc Sort Data=Rep&Survey; By QstNum OccurNum; Data CPS&Survey; Merge CPS&Survey(In=In1) Rep&Survey; By QstNum OccurNum; If In1; %Mend; %ReadData(feb03); Run; %ReadData(jun03); Run; %ReadData(nov03); Run; Data CPS03; Array Wgts(81) SmplWgt RepWgt01-RepWgt80; Set CPSfeb03 CPSjun03 CPSnov03; Do I = 1 to 81; Wgts(I)=Wgts(I)/3; End; If (18<=PrtAge<=24) Then AgeGrp=1; Else If (25<=PrtAge<=44) Then AgeGrp=2; Else If (45<=PrtAge<=64) Then AgeGrp=3; Else If (PrtAge>64) Then AgeGrp=4; If SmokStat In (2,3) Then Current=1; Else If SmokStat In (1,4) Then Current=2; Format AgeGrp AgeGrpF. PESex PESexF. Current CurrentF.; Label PESex = "Gender" SmokStat = "Smoker Recode" AgeGrp = "Age Group" Current = "Current Cigarette Smoker" QstNum = "Unique Household Identifier" OccurNum = "Unique Person Identifier"; Run; Proc Crosstab Data=CPS03 Design=BRR; /* SUDAAN CrossTab Procedure */ Setenv DecWidth=4; Weight SmplWgt; RepWgt RepWgt01-RepWgt80/ADJFay=4; Subgroup Current PESex AgeGrp; Levels 2 2 4; Tables PESex*Current AgeGrp*Current; RTitle "2003 Tobacco Use Special Cessation Supplement to The Current Population Survey"; RTitle "February, June and November"; RTitle "Interviewed, Adults, Ages 18 and Over"; RTitle "Self and Proxy Respondents"; RTitle "Current Cigarette Smoking Status By Gender and Age Group"; Print NSum = "Sample Size" WSum = "Population Size" RowPer = "Percent" SERow = "Standard Error" LowRow = "Lower 95% CI" UpRow = "Upper 95% CI" /NSumFmt=F8.0 WSumFmt=F10.0; Run; S U D A A N Software for the Statistical Analysis of Correlated Data Copyright Research Triangle Institute February 2005 Release 9.0.1 Number of observations read : 234274 Weighted count :211127389 Denominator degrees of freedom : 80 Date: 10-16-2007 Research Triangle Institute Page : 1 Time: 08:25:01 The CROSSTAB Procedure Table : 1 Variance Estimation Method: BRR 2003 Tobacco Use Special Cessation Supplement to The Current Population Survey February, June and November Interviewed, Adults, Ages 18 and Over Self and Proxy Respondents Current Cigarette Smoking Status By Gender and Age Group by: Gender, Current Cigarette Smoker. ----------------------------------------------------------------------------- | | | | Gender | | Current Cigarette Smoker | | | Total | Yes | No | ----------------------------------------------------------------------------- | | | | | | | Total | Sample Size | 234274 | 43831 | 190443 | | | Population Size | 211127389 | 38802077 | 172325312 | | | Percent | 100.0000 | 18.3785 | 81.6215 | | | Standard Error | 0.0000 | 0.1439 | 0.1439 | | | Lower 95% CI | . | 18.0938 | 81.3333 | | | Upper 95% CI | . | 18.6667 | 81.9062 | ----------------------------------------------------------------------------- | | | | | | | Male | Sample Size | 110041 | 22851 | 87190 | | | Population Size | 101244033 | 20952265 | 80291768 | | | Percent | 100.0000 | 20.6948 | 79.3052 | | | Standard Error | 0.0000 | 0.1860 | 0.1860 | | | Lower 95% CI | . | 20.3271 | 78.9325 | | | Upper 95% CI | . | 21.0675 | 79.6729 | ----------------------------------------------------------------------------- | | | | | | | Female | Sample Size | 124233 | 20980 | 103253 | | | Population Size | 109883356 | 17849813 | 92033544 | | | Percent | 100.0000 | 16.2443 | 83.7557 | | | Standard Error | 0.0000 | 0.1569 | 0.1569 | | | Lower 95% CI | . | 15.9344 | 83.4409 | | | Upper 95% CI | . | 16.5591 | 84.0656 | ----------------------------------------------------------------------------- Date: 10-16-2007 Research Triangle Institute Page : 2 Time: 08:25:01 The CROSSTAB Procedure Table : 2 Variance Estimation Method: BRR 2003 Tobacco Use Special Cessation Supplement to The Current Population Survey February, June and November Interviewed, Adults, Ages 18 and Over Self and Proxy Respondents Current Cigarette Smoking Status By Gender and Age Group by: Age Group, Current Cigarette Smoker. ----------------------------------------------------------------------------- | | | | Age Group | | Current Cigarette Smoker | | | Total | Yes | No | ----------------------------------------------------------------------------- | | | | | | | Total | Sample Size | 234274 | 43831 | 190443 | | | Population Size | 211127389 | 38802077 | 172325312 | | | Percent | 100.0000 | 18.3785 | 81.6215 | | | Standard Error | 0.0000 | 0.1439 | 0.1439 | | | Lower 95% CI | . | 18.0938 | 81.3333 | | | Upper 95% CI | . | 18.6667 | 81.9062 | ----------------------------------------------------------------------------- | | | | | | | 18-24 | Sample Size | 26462 | 5524 | 20938 | | | Population Size | 27133437 | 5415382 | 21718055 | | | Percent | 100.0000 | 19.9583 | 80.0417 | | | Standard Error | 0.0000 | 0.3152 | 0.3152 | | | Lower 95% CI | . | 19.3384 | 79.4069 | | | Upper 95% CI | . | 20.5931 | 80.6616 | ----------------------------------------------------------------------------- | | | | | | | 25-44 | Sample Size | 88260 | 19362 | 68898 | | | Population Size | 82212477 | 17291823 | 64920654 | | | Percent | 100.0000 | 21.0331 | 78.9669 | | | Standard Error | 0.0000 | 0.1957 | 0.1957 | | | Lower 95% CI | . | 20.6462 | 78.5747 | | | Upper 95% CI | . | 21.4253 | 79.3538 | ----------------------------------------------------------------------------- | | | | | | | 45-64 | Sample Size | 78176 | 15482 | 62694 | | | Population Size | 67750818 | 13281816 | 54469001 | | | Percent | 100.0000 | 19.6039 | 80.3961 | | | Standard Error | 0.0000 | 0.1929 | 0.1929 | | | Lower 95% CI | . | 19.2229 | 80.0094 | | | Upper 95% CI | . | 19.9906 | 80.7771 | ----------------------------------------------------------------------------- | | | | | | | 65+ | Sample Size | 41376 | 3463 | 37913 | | | Population Size | 34030658 | 2813056 | 31217602 | | | Percent | 100.0000 | 8.2662 | 91.7338 | | | Standard Error | 0.0000 | 0.1556 | 0.1556 | | | Lower 95% CI | . | 7.9619 | 91.4188 | | | Upper 95% CI | . | 8.5812 | 92.0381 | ----------------------------------------------------------------------------- October 16, 2007