Hi All,
I am using the attached code to establish a ratio of sold to bought products.
What I want to do however is:
A) Control the order of the variables which are returned to me (product) so that they are no longer in alphabetical order.
B) Include an additional variable which is called "Total Fresh" and a variable called "Total Processed" so that products which are tinned or frozen are used to calculate the Total Processed ratio, whilst non-tinned and non-frozen products calculate the Total Fresh ratio (there is presently no variable to denote this).
Is anyone able to give me any advice on this?
options nodate pageno=1 linesize=64
pagesize=60;
proc report Data=Merged nowd Out = Frequency headline headskip;
column yr mth Product, (Sold Bought Frequency);
define Product / Across ' ';
define Yr / Group ' ' noprint;
define Mth / Group ' ';
define Bought / Analysis format = comma12.6 Sum noprint;
define Sold / Analysis format = comma12. Sum noprint;
define Ratio / Computed format = percent9.2 ' ';
Compute Ratio;
_c5_ = _c3_ /_c4_ ;
_c8_ = _c6_ /_c7_ ;
_c11_ = _c9_ /_c10_ ;
_c14_ = _c12_/_c13_ ;
_c17_ = _c15_/_c16_ ;
_c20_ = _c18_/_c19_ ;
Endcomp;
Compute mth;
IF _break_='_RBREAK_' THEN
CALL DEFINE('mth','style','style=[pretext="TOTAL"]');
Endcomp;
break after Yr / summarize skip;
run;
Message was edited by: Scottcom4
... View more