The SAS Output Delivery System and reporting techniques

Current month vs Rolling month

Posts: 69

Current month vs Rolling month


I am having the following variables as pr_num,week,product,total_rxn,total_rx,sbu,terri_state and district.
I want to group the product by terri_state ,total_rxn,total_rx,district for the current month & previous month(here the date format is like this ddmmyyyy.
I need to develop a report for the current month & previous month.
Can anyone help me in this regard.

Posts: 8,743

Re: Current month vs Rolling month

You have left out some valuable information. Do you have detail data? Do you already have summarized data? The presence of variables TOTAL_RXN and TOTAL_RX imply that your data is already summarized.

When you say you want to
"group the product by terri_state ,total_rxn,total_rx,district "
do you mean that you want a report that is summarized at different levels? Do you want to have a summary line for every unique PRODUCT and TERRI_STATE combination? or do you want to see ALL the products for one TERRI_STATE???

This is an instance where some dummy data would be useful to see, as well as an example of what you expect the output report to look like. Also, some idea of what you've already tried -- PROC MEANS or PROC PRINT??? Do you think you need PROC TABULATE or PROC REPORT??? How did you create the TOTAL_RXN and TOTAL_RX columns??? You give us a DATE format, but you only have a WEEK variable -- generally a WEEK variable will range from 1 to 52. Or, is your WEEK variable actually a DATE variable????

You also don't say whether you have all the data (current month and previous month) in ONE file/dataset or whether current month is in ONE file/dataset and previous month is in a separate file/dataset. Also, on the report -- do you envision one page for the the current month and a second page for the previous month, or do you want to see the current month information and the previous month information on the same report row????

Also useful to know, since you're posting in the ODS forum, is information about your destination of choice -- do you want an HTML report, and RTF report, a PDF report????

If you are going to post your code or a sample of your data, this is a very handy forum posting that explains how to post questions and still maintain the indenting of code and of output that you want to show:毙

Posts: 69

Re: Current month vs Rolling month

Hi Cynthia,

Basically it's a detail data and we got the variables TOTAL_RXN and TOTAL_RX in detail data itself.
A summary line for every unique PRODUCT and TERRI_STATE combination with all products.
And WEEK variable is actually a DATE variable.
I am having all the data (current month and previous month) in ONE file and want to see data related to current month information and previous month information.
After finding all these, we generally export it to excel spreadsheet.

Thanks in advance,
Super Contributor
Super Contributor
Posts: 3,174

Re: Current month vs Rolling month

As Cynthia pointed out, have you tried any SAS PROC, such as PROC REPORT, PROC SUMMARY (with PRINT), or PROC MEANS? With a SAS DATE variable, you can look into using INTNX function within a DATA step to create a suitable "week start" or "month start" date and then use a suitable SAS FORMAT statement for displaying the date as you desire.

Are you looking to others on the forum to write the code for you? That is why I am inquiring about what, if any, SAS program coding you have attempted, to solve your quest.

Scott Barry
SBBWorks, Inc.

Recommended Google advanced search argument for this topic:

create summary report

-- one match to consider:

SAS DOC: Practical Problem-Solving with PROC SQL
Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation