BookmarkSubscribeRSS Feed
Calcite | Level 5

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.

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:毙

Calcite | Level 5
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,
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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


Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 3 in conversation