BookmarkSubscribeRSS Feed
AshokD
Obsidian | Level 7

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

textvolume_final
1Cycle Due = 2 2
2Cycle Due = 32
3Cycle Due = 4 0
4Cycle Due = 52
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:-

 

BillDayCycle Due = 2Cycle Due = 3Cycle Due = 4Cycle Due = 5
BD012010
BD022231
BD032231
 6472

 

Expected Report:- 

 

                                                                                        2019
                                 JANUARY                                    FEBRUARY
 Cycle Due = 2 Cycle Due = 3Cycle Due = 4Cycle Due = 5Cycle Due = 2 Cycle Due = 3Cycle Due = 4Cycle Due = 5
BD0122022000
BD0210013011
BD0331001100
BD0410001001
BD0510002000
BD0630002001
BD0720000000
BD0820024000
BD0910120000
BD1010003000
 1731718113

 

 

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.

 

1 REPLY 1
ballardw
Super User

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.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 815 views
  • 0 likes
  • 2 in conversation