Thanks. Attaching the macro section below (I hesitated to initially include because there are so many variables involved). It would be great if the plots could incorporate the macro and create individual plots (one for each variable showing the time trend). Any other tips you may have would be greatly appreciated. Actually, is it even possible to plot the Cochran Armitage trend plots? (maybe there is no easy graphic for this) Thanks. data t; set g2; if HHIncGen in:(1) then inc=0 ; /*less than 10,000*/ if HHIncSpec in:(1) then inc=0 ; /*10,000 to 19,000*/ if HHIncSpec in:(2) then inc=0 ; /*20,000 to 29,000*/ if HHIncSpec in:(3) then inc=0 ; /*30,000 to 39,000*/ if HHIncSpec in:(4) then inc=0 ; /*40,000 to 49,000*/ if HHIncGen in:(2) then inc=1 ; /*50,000+*/ if HHIncSup in:(0,1,2,3) then incs=0; if HHIncSup ge 4 then incs=1; if livebirths in:(0) then lb=0; if livebirths ge 1 then lb=1; if Mlang in:(8) then lang=0;/*english*/ if Mlang in:(24) then lang=1; /*spanish*/ if c_meduc in:(1,2) then educ_d=1; if c_meduc in:(3,4,5) then educ_d=0; if C_bminih in:(1,2) then bmid=0; if C_bminih in:(3,4) then bmid=1; if **bleep**e_EDDyr lt 25 then **bleep**e=0; if **bleep**e_EDDyr ge 25 and **bleep**e_EDDyr lt 35 then **bleep**e=0; if **bleep**e_EDDyr ge 35 and **bleep**e_EDDyr lt 45 then **bleep**e=1; if **bleep**e_EDDyr ge 45 then **bleep**e=1; if C_mage_e lt 35 then mage=0; if C_mage_e ge 35 then mage=1; if C_binge4 in:(0,2) then binge=0; if C_binge4 in:(1) then binge=1; if MDS_qrtl in:(0,1) then mds2=0; if MDS_qrtl in:(2,3) then mds2=1; if DQI_qrtl in:(0,1) then dqi2=0; if DQI_qrtl in:(2,3) then dqi2=1; run; %let indvar = /*DQI_qrtl MDS_qrtl */ mds2 /*GUI_B3P3 */ binge tc mage C_mrace C_frace Crace educ_d Mborn myrs inc incs lang C_smoke work_or_home_B1P3 /*worksmk_B1P3*/ hsmkpg homesmk_B1P3 lb plurality AnyOC LocID diab1_2 gestndiab_During2 HBP HBPPg bmid hhinc HH_dichot_median **bleep**e MMarij mcocaine mcrack mhalluc mhash MHeroin MMush MJob MAForces Prenatal Anyscan Fertgate Nausea Heat_expB1P9 DrinkCook_1 seiz solvent /*pregnancy intention*/ int /*residential moves B1P3*/ movingb1p3 injuryb1p3 GU_infectionb1p3 bronchodilatorb1p3 antiherpeticsb1p3 opioidb1p3 illicit_drugb1p3 short_IPI /*fever from cold or flu B1P3*/ b1p3coldflu_fever /*kidney, bladder, or UTI B3P9*/ KidBlUTI pah_exp mds2 dqi2 Inf_UTI_FevAny homesmk_B1P3; /*missings*/ %let missvar = if (DQI_qrtl in:(.) or MDS_qrtl in:(.) or GUI_B3P3 in:(.) or C_binge4 in:(.) or tc in:(.) or /*no missings for C_mage_e*/ C_mrace in:(.) or C_frace in:(.) or Crace in:(.) or C_meduc in:(.) or Mborn in:(.) or myrs in:(.) or HHIncsup in:(.) or Mlang in:(.) or C_smoke in:(.) or work_or_home_B1P3 in:(.) or hsmkpg in(.) or /*worksmk_B1P3*/ WsmkB1 in:(.) or WsmkM1 in:(.) or WsmkM2 in:(.) or WsmkM3 in:(.) or /*homesmk_B1P3*/ HsmkB1 in:(.) or HsmkM1 in:(.) or HsmkM2 in:(.) or HsmkM3 in:(.) or livebirths in:(.) or plurality in:(.) or AnyOC in:(.) or /*no missings for LocID*/ diab1_2 in:(.) or /*no missings for gestndiab_During2*/ HBP in:(.) or HBPPg in:(.) or C_bminih in:(.) or hhinc in:(.) or HH_dichot_median in:(.) or /*use **bleep**e for father's age*/ FBirthDD in:(.) or FBirthMM in:(.) or FBirthYY in:(.) or MMarij in:(.) or mcocaine in:(.) or mcrack in:(.) or mhalluc in:(.) or mhash in:(.) or MHeroin in:(.) or MMush in:(.) or MJob in:(.) or MAForces in:(.) or Prenatal in:(.) or Anyscan in:(.) or Fertgate in:(.) or Nausea in:(.) or Heat_expB1P9 in(.) or DrinkCook_1 in:(.) or seiz in:(.) or solvent in:(.) or /*pregnancy intention*/ int in:(.) or /*residential moves B1P3*/ movingb1p3 in:(.) or injuryb1p3 in:(.) or GU_infectionb1p3 in:(.) or bronchodilatorb1p3 in:(.) or antiherpeticsb1p3 in:(.) or opioidb1p3 in:(.) or illicit_drugb1p3 in:(.) or short_IPI in:(.) or /*fever from cold or flu B1P3*/ b1p3coldflu_fever in:(.) or /*kidney, bladder, or UTI B3P9*/ KidBlUTI in:(.) or pah_exp in:(.)) then delete; run; data i7; set g2; &missvar; run; /*Cochran Armitage Test for trend*/ proc freq data=t; tables C_EDDYR*(&indvar) / trend; where gastro_isol=0; run; /*try to plot time trend*/ proc gplot data=t; plot C_EDDYR*(&indvar); symbol1 v=star c=blue; title "Time Series Plot for (&indvar) and Year of Estimated Delivery"; where gastro_isol=0; run; quit; title; proc sgpanel data=t ; panelby (&indvar); series x=C_EDDYR y=(&indvar); where gastro_isol=0; run;
... View more