Hello,
I have just noticed that I was doing something wrong with my PROC TABULATE.
Basically, I would like the newly created variable "Rate" to calculate predict /actual column by column (INCLUDING the TOTAL column). It does it fine until the TOTAL column, where SAS sums up all the Rates instead of dividing predict/actual. If you run the code, you'll find out that the rate for Canada 1997 = 5.31 but I woul like it to read 1.06 (1,889,464 / 1,781,102).
Is there another statistic that could help me with this? See my code below :
[pre]
PROC TABULATE
DATA=SASHELP.PRDSAL3
OUT=WORK.SALE1;
TITLE;
TITLE1 "Sale #1";
VAR predict actual;
CLASS country / ORDER=UNFORMATTED MISSING;
CLASS year / ORDER=UNFORMATTED MISSING;
CLASS product / ORDER=UNFORMATTED MISSING;
TABLE
/* Row Dimension */
year={LABEL=''}*(product={LABEL=''} ALL={LABEL='TOTAL'}),
/* Column Dimension */
country*(predict*sum={label=''} actual*Sum={LABEL=''})
/ BOX={LABEL=_PAGE_} PRINTMISS MISSTEXT='0' INDENT=0 ;
;
RUN;
DATA WORK.SALE2;
SET WORK.SALE1;
Rate=predict_sum/actual_sum;
RUN;
PROC TABULATE
DATA=WORK.SALE2;
TITLE1 "Sale #3";
VAR predict_sum actual_sum rate;
CLASS country / ORDER=UNFORMATTED MISSING;
CLASS year / ORDER=UNFORMATTED MISSING;
CLASS product / ORDER=UNFORMATTED MISSING;
TABLE
/* Row Dimension */
year={LABEL=''}*(product={LABEL=''} ALL={LABEL='TOTAL'}),
/* Column Dimension */
country*(predict_sum*sum={label=''} actual_sum*Sum={LABEL=''} rate*sum={LABEL=''})
/ BOX={LABEL=_PAGE_} PRINTMISS MISSTEXT='0' INDENT=0 ;
;
RUN;
[/pre]
Edit : I'm sorry code looks funny...I took the time to format it all in SAS, but apparently the [ pre ] option does not like it...hope it is still readable.
Message was edited by: SamuelG.