need to write a program so that i can get my output as above, can anyone please help?
First, you need to provide example data, as working SAS data step code (instructions) and not in any other format. I think either PROC REPORT or PROC TABULATE can do this, but that's as far as I can go without having example data.
data test;
input client $ sales card $ trn_dt date9.;
cards;
WLM 100 Mast 1Jan2023
WLM 200 Visa 6Feb2023
WLM 400 Disc 7Mar2023
WLM 500 Mast 4Apr2023
WLM 900 Visa 3May2023
WLM 100 Disc 2Jun2023
WLM 300 Mast 1Jul2023
WLM 100 Visa 8Aug2023
WLM 400 Disc 9Sep2023
WLM 200 Mast 2Oct2023
WLM 200 Visa 3Nov2023
WLM 400 Disc 7Dec2023
;
run;
proc summary data=test nway;
class client card trn_dt card;
format trn_dt yyq5.;
var sales;
output out=stats(drop=_:) sum=;
run;
data stats1;
lenght name $ 22;
set stats;
by client card trn_dt;
prev_sales=lag(sales);
if first.card then prev_sales=.;
q_over_q=sales/prev_sales;
value=sales; name='Current Quarter Sales'; output;
value=prev_sales; name='Last Quarter Sales'; output;
value=q_over_q; name='Q over Q'; output;
run;
proc sort data=stats1;
by client trn_dt;
run;
proc report data=stats1;
by client trn_dt;
columns name (" " value),card;
define name/" " group order=data;
define card/across "Card";
define value/sum " ";
label client='Client' trn_dt='Quarter';
run;
Since you didn't give data that would allow me to obtain 12 month running average, I can't put it into the code.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.