BookmarkSubscribeRSS Feed
Siddhartha
Calcite | Level 5
Hi,

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.

Regards,
Sid
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
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:
http://support.sas.com/forums/thread.jspa?messageID=27609毙

cynthia
Siddhartha
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,
Siddhartha
sbb
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 site:sas.com

-- one match to consider:

SAS DOC: Practical Problem-Solving with PROC SQL
http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a002536887.htm

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 708 views
  • 0 likes
  • 3 in conversation