Hi All ,
I need to run the job on a daily basis , to track the daily records for the billing days over the months.
Data final;
set smydata.summary_final_rs;
run;
proc sort data=final; by record_n; run;
FINAL data set - Sample data
Obs | text | volume_final |
1 | Cycle Due = 2 | 2 |
2 | Cycle Due = 3 | 2 |
3 | Cycle Due = 4 | 0 |
4 | Cycle Due = 5 | 2 |
data final1(drop=record_n);
format text $100. billday $5. ;
set final;
billday = symget('bill_day');
if _n_ =1 then text = 'text1';
else if _n_ =2 then text = 'text2';
else if _n_ = 3 then text = 'text3';
else if _n_ = 4 then text = 'text4';
run;
proc transpose data=final1 out=final2 (drop=text)
name=text;
id text;
BY billday;
run;
PROC append base=datalib.pymtdtls
data=final2;
run;
proc report data=datalib.pymtdtls;
column billday text1 text2 text3 text4;
define billday /display 'BillDay';
define text1 /sum 'Cycle Due = 2';
define text2 /sum 'Cycle Due = 3';
define text3 /sum 'Cycle Due = 4';
define text4 /sum 'Cycle Due = 5';
rbreak after / dol skip summarize;
run;
#1) For example , I am running the job on January month - Day 1 , the above FINAL data set values needs to be posted in the report and when comes to Day 2 , FINAL data set will populate different values and needs to be append to the same report and it continues till day 31 of January. Also , we need to calculate the sum up the totals at the end of the report.
* #2) Above Step #1 , will be followed for all the months in 2019 Jan -Dec , for the upcoming months new column needs to be added when we run the code at the respective months and also for the upcoming years as well.
Actual report copy created from the above code:-
BillDay | Cycle Due = 2 | Cycle Due = 3 | Cycle Due = 4 | Cycle Due = 5 |
BD01 | 2 | 0 | 1 | 0 |
BD02 | 2 | 2 | 3 | 1 |
BD03 | 2 | 2 | 3 | 1 |
6 | 4 | 7 | 2 |
Expected Report:-
2019 | ||||||||
JANUARY | FEBRUARY | |||||||
Cycle Due = 2 | Cycle Due = 3 | Cycle Due = 4 | Cycle Due = 5 | Cycle Due = 2 | Cycle Due = 3 | Cycle Due = 4 | Cycle Due = 5 | |
BD01 | 2 | 2 | 0 | 2 | 2 | 0 | 0 | 0 |
BD02 | 1 | 0 | 0 | 1 | 3 | 0 | 1 | 1 |
BD03 | 3 | 1 | 0 | 0 | 1 | 1 | 0 | 0 |
BD04 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
BD05 | 1 | 0 | 0 | 0 | 2 | 0 | 0 | 0 |
BD06 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | 1 |
BD07 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
BD08 | 2 | 0 | 0 | 2 | 4 | 0 | 0 | 0 |
BD09 | 1 | 0 | 1 | 2 | 0 | 0 | 0 | 0 |
BD10 | 1 | 0 | 0 | 0 | 3 | 0 | 0 | 0 |
17 | 3 | 1 | 7 | 18 | 1 | 1 | 3 |
Can someone guide me in the above coding changes to achieve the expected results ? Is there any other proc which is sufficient to get the expected results ?
Thanks in advance for your help.
Does your data have any actual date values in it? Actual SAS date values perhaps?
Without something to indicate dates I have no idea how you would ever get month or year information as requested.
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.