/* Create data sets for comparisons */ proc means data=sashelp.prdsal2(rename=(MonYr=Date)) noprint nway; where state="Illinois" and County="Cook" and Product="CHAIR" and Date between "01jan1996"d and "31dec1997"d and month(Date) between 6 and 8; class Date; id Country ProdType; var Actual Predict; output out=Summer_prdtot2 sum=Actual Predict; run; proc print data=Summer_prdtot2; id Date; var Actual Predict Country ProdType; title1 "SUMMER_PRDTOT2 data set"; run; proc means data=sashelp.prdsal3 noprint nway; where state="Illinois" and County="Cook" and Product="CHAIR" and month(Date) between 6 and 8; class Date; id Country ProdType; var Actual Predict; output out=Summer_prdtot3 sum=Actual Predict; run; proc print data=Summer_prdtot3; id Date; var Actual Predict Country ProdType; title1 "SUMMER_PRDTOT3 data set"; run; /* Create data set for transposing */ proc means data=sashelp.prdsal3 noprint nway; where ProdType='OFFICE'; class Product Date; format Date yymm7.; var Actual; output out=PrdSummary(drop=_type_ _freq_) sum=Actual; run; proc print data=PrdSummary; id Product Date; title1 "PRDSUMMARY data set"; run; proc means data=sashelp.prdsal2 noprint nway; where Country="Canada" and Product="CHAIR"; class State MonYr; var Actual; format MonYr year4.; output out=Annual sum=Actual; run; proc transpose data=Annual out=AllYears(drop=_Name_ _label_) prefix=Sales; by State; id MonYr; var Actual; run; proc print data=AllYears; title1 "ALLYEARS Data Set"; run; /* Create data sets for updates */ proc means data=sashelp.prdsal2(rename=(MonYr=Date)) noprint nway; where state="Illinois" and County="Cook" and Product="CHAIR" and Date between "01jan1996"d and "31dec1997"d; class Date; format Date yyq6.; var Actual Predict; output out=Sales1997(index=(Date) drop=_TYPE_ _FREQ_) sum=Actual Predict; run; proc print data=Sales1997; title1 "Sales1997 data set before UPDATE"; run; proc means data=sashelp.prdsal3 noprint nway; where state="Illinois" and County="Cook" and Product="CHAIR" and Date between "01jan1997"d and "31dec1997"d; class Date; format Date yyq6.; var Actual; output out=transactions(drop=_TYPE_ _FREQ_) sum=Actual; run; proc print data=transactions; title1 "Transactions to be Applied to Sales1997 data set"; run; /* End of Month Sales Data */ proc means data=sashelp.prdsal3 noprint nway; where state="Illinois" and County="Cook" and Product="CHAIR" and Date between "01jan1997"d and "31dec1997"d; class Date; var Actual; output out=StartOfMonth(drop=_TYPE_ _FREQ_) sum=Actual; run; proc print data=StartOfMonth; title1 "Start of Month Sales Data"; run; data EndOfMonth; set StartOfMonth; Date=intnx("month",Date,0,"E"); Date=intnx("year",Date,11,"SAME"); format Date date9.; run; proc print data=EndOfMonth; title1 "End Of Month Sales Data"; run; /* Create summary data for merging */ proc means data=sashelp.prdsal2 noprint nway; where year=1997; class MonYr; var Actual; output out=prdtot2(drop=_FREQ_ _TYPE_) sum=Total2; run; proc print data=prdtot2(obs=10); var MonYr Total2; title1 "PRDTOT2 data set"; run; proc means data=sashelp.prdsal3 noprint nway; where year=1997; class Date; var Actual; output out=prdtot3(drop=_FREQ_ _TYPE_) sum=Total3; run; proc print data=prdtot3(obs=10); var Date Total3; title1 "PRDTOT3 data set"; run;