OPTIONS LINESIZE=90 PAGESIZE=54 NOCENTER NODATE ; * Program Name and Location, Date Programmer ; TITLE1 "Source: behs8.SAS behs #1 12/6/98 EJS" ; *** Description: ; * Combine data to get plot of prevalence for smoking ; * greater than 5 cigarettes per day ; * 1995 Hampshire county survey and Amherst survey ; *******************************************************; LIBNAME old "c:\ed\courses\behs\smoke\data\"; ********************************************************; *** Create data set with common variables from Hampshire; *** study ; ********************************************************; PROC FORMAT; VALUE noyesf 0="No" 1="Yes"; VALUE studyf 1="Hampshire" 2="ARHS"; PROC FORMAT CNTLIN=old.hbf1f; DATA hbf1; SET old.hbf1; IF county=1; * Select Hampshire County; ****************************************; *** Only keep subject with known gender ; *** and known cigs/day ; ****************************************; IF q32 ne .; IF q11 ne .; **************************************; *** Create current smoker variable *; *** Use as the definition smoke > 5/d*; **************************************; IF q11 IN (1,2,3) THEN Q11v1=0; IF q11 IN (4,5,6,7) THEN q11v1=1; LABEL q11v1="Smoke/>5 cig/Day?/(Q11V1)"; FORMAT q11v1 noyesf.; FORMAT q3 q3f. q10 q10f. q11 q11f. q31 q31f. q32 q32f. q43a q43b q43f. county countyf.; DATA hbf2 (KEEP=study id smoke gender grade); SET hbf1; study=1; id=distid; smoke=q11v1; gender=q32; grade=q3+6; FORMAT smoke noyesf.; ********************************************************; *** Create data set with common variables from ARHS ; *** study ; ********************************************************; PROC FORMAT CNTLIN=old.arhs1f; DATA arhs1; SET old.arhs1; *********************************; *** Create Current 6+ Smoker Var ; *********************************; IF q4 LT 5 then q4v1=0; IF 5 LE q4 LT 99 then q4v1=1; IF q4v1=. THEN DELETE; IF q9 NE . ; IF q10 NE . ; FILE PRINT; IF q4v1=. then PUT q1= q3= q4= q4v1=; LABEL q4v1="Smoke/>5/day/(Q4v1)"; FORMAT q1 q3 q4v1 q5a q5b q5c q5d q5e q5f q6 q7 noyesf. q10 classf. q9 genderf. q12 schoolf.; DATA arhs2 (KEEP=study id smoke gender grade); SET arhs1; study=2; id=q15*100+q14; smoke=q4v1; gender=q9; grade=q10+8; FORMAT smoke noyesf.; PROC CONTENTS DATA=hbf2; PROC CONTENTS DATA=arhs2; DATA c1; SET hbf2 arhs2; FORMAT study studyf.; PROC FREQ DATA=c1; TABLES study*grade*smoke / MISSPRINT NOCOL NOPERCENT NOCUM; TITLE2 "Student Reporting Currently Smoking > 5 cigs/d "; RUN;