I'm having a lot of success with PROC REPORT, but I have one major hangup. First off, my data is single family and multi family housing completions by county. So I have a column of SF completions in 2012, then a computed column with the V%, or percent change from 2011 to 2012. So far so good. But the summary line needs to be the sum of this year's housing starts (Again, easy...) and the V% of those counties from last year to this year. I've tried using: define SF_TOT_V / analysis mean weight=sftall 'V%' Width=4 format=8.0; where sftall is the sum of housing starts for 2011 & 2012. I've tried using EVERYTHING as this weight. I've gotten nothing. Anyone who has ever had to do this before? My code is attached here: data Contract; retain salescode cnty_stat TotalV sf2012 SF_V sf_tot SF_TOT_V sfcompl2012 SF_COMP_V mf2012 MF_V mf_tot MF_TOT_V mfcompl2012 MF_COMP_V TotDir TotDirV TotUnits TotUnitsV TotComp ; set alm1; sf_tot = round(sft2012,1); mf_tot = round(mft2012,1); SF_V = round(divide((sf2012-sf2011),sf2011) *100,1); sftall=(sft2011+sft2012); SF_TOT_V = round(divide((sf_tot-sft2011),sft2011)*100,1); SF_COMP_V = round(divide((sfcompl2012-sfcompl2011),sfcompl2011)*100,1); MF_V = round(divide((mf2012-mf2011),mf2011)*100,1); MF_TOT_V = round(divide((mf_tot-mft2011),mft2011)*100,1); MF_COMP_V = round(divide((mfcompl2012-mfcompl2011),mfcompl2011)*100,1); TotDir = sf2012 + mf2012; TotDir2011 = sf2011 + mf2011; TotDirV = round(divide((TotDir - TotDir2011),TotDir2011)*100,1); TotUnits = sft2012 + mft2012; TotUnits2011 = sft2011 + mft2011; TotUnitsV = round(divide((TotUnits - TotUnits2011),TotUnits2011)*100,1); TotComp = sfcompl2012 + mfcompl2012; TotComp2011 = sfcompl2011 + mfcompl2011; TotComp2012 = sfcompl2012 + mfcompl2012; TotalV = round(divide((TotComp - TotComp2011),TotComp2011)*100,1); mftall = mft2012+mft2011; keep salescode cnty_stat TotalV sf2012 SF_V sft2012 SF_TOT_V sfcompl2012 SF_COMP_V mf2012 MF_V mft2012 MF_TOT_V mfcompl2012 MF_COMP_V TotDir TotDirV TotUnits TotUnitsV TotComp srsregn cregname mftall sftall; run; /************************************************************************************/ /************************************************************************************/ ods rtf file='C:\Documents and Settings\aaronm\Desktop\DP186\TESTING.doc'; proc report data=Contract nowindows; title1 'Contract Performance Summary - Total Share Products'; title2 'Operation: &Name Region: &Region'; title3 'YTD &Month, &Year'; columns salescode cnty_stat sf2012 SF_V sft2012 SF_TOT_V sfcompl2012 SF_COMP_V mf2012 MF_V mft2012 MF_TOT_V mfcompl2012 MF_COMP_V TotDir TotDirV TotUnits TotUnitsV TotComp TotalV sftall mftall; define Cnty_Stat / display 'County' Width=25; define sf2012 / analysis sum 'SF Dir' Width=4 format=8.0; define SF_V / analysis mean 'V%' Width=4 format=8.0; define sft2012 / analysis sum 'SF Total' Width=4 format=8.0; define SF_TOT_V / analysis mean weight=sftall 'V%' Width=4 format=8.0; define sfcompl2012 / analysis sum 'SF Comp' Width=4 format=8.0; define SF_COMP_V / analysis mean weight=sfcompl2012 'V%' Width=4 format=8.0; define mf2012 / analysis sum 'MF Dir' Width=4 format=8.0; define MF_V / analysis mean weight=mf2012 'V%' Width=4 format=8.0; define mft2012 / analysis sum 'MF Tot' Width=4 format=8.0; define MF_TOT_V / analysis mean weight=mftall 'V%' Width=4 format=8.0; define mfcompl2012 / analysis sum 'MF Comp' Width=4 format=8.0; define MF_COMP_V / analysis mean weight=mfcompl2012 'V%' Width=4 format=8.0; define TotDir / analysis sum 'Tot Dir' Width=4 format=8.0; define TotDirV / analysis mean weight=TotDir 'V%' Width=4 format=8.0; define TotUnits / analysis sum 'Tot Units' Width=4 format=8.0; define TotUnitsV / analysis mean weight=TotUnits 'V%' Width=4 format=8.0; define TotComp / analysis sum 'Tot Comp' Width=4; define TotalV / display 'V%' Width=4 format=8.0; define sftall / noprint; define salescode / group; compute Cnty_Stat; bg +1; if mod(bg,2)=1 then call define(_row_, "style", "Style={background=white}"); else call define(_row_, "style", "Style={background=#d1e9d1}"); endcomp; break after salescode / page summarize; run;
... View more