BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8
How to generate a single report instead two?
/** grouping yearly****/
proc sql noprint;
create table rpt3a as
select distinct terrid,region,bsm, md_zip,PHYS_ADDRESS1,PHYSICIAN_ADDRESS2,pat_seq_id1,phys_city,md_state,physician_name, sum(total_scripts) as T_yr, year, productgroup
from prescriberdata_v2
group by terrid,region, md_zip, bsm,PHYS_ADDRESS1,PHYSICIAN_ADDRESS2,physician_name ,pat_seq_id1, year, productgroup,md_zip,phys_city,md_state;
quit;
Generate report at year level:

proc report data=rpt3a nowd NOWINDOWS HEADLINE MISSING;
COLUMN terrid region bsm md_zip physician_name PHYS_ADDRESS1 PHYSICIAN_ADDRESS2 phys_city md_state pat_seq_id1 t_yr,year, productgroup ;
---SAS code follows---
run;


/** grouping at year_month****/
proc sql noprint;
create table rpt3b as
select distinct terrid,region,bsm, md_zip,PHYS_ADDRESS1,PHYSICIAN_ADDRESS2,pat_seq_id1,phys_city,md_state,physician_name, sum(total_scripts) as T_yr_m, year_month, productgroup
from prescriberdata_v2
group by terrid,region, md_zip, bsm,PHYS_ADDRESS1,PHYSICIAN_ADDRESS2,physician_name ,pat_seq_id1, year_month, productgroup,md_zip,phys_city,md_state;;
quit;

Generate report at year_month level:
proc report data=rpt3b nowd NOWINDOWS HEADLINE MISSING;
COLUMN terrid region bsm md_zip physician_name PHYS_ADDRESS1 PHYSICIAN_ADDRESS2 phys_city md_state pat_seq_id1 t_yr_m,year_month, productgroup;
---SAS code Follows---
run;


The final report I copy the second report and paste it in the first report.
I'm wondering if there is a way to do in a single report.
This will save time and manual errors.
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
Just wondering whether this is a new set of reports or whether this is related to your previous posting?
http://support.sas.com/forums/thread.jspa?messageID=20499倓

cynthia
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You have explained nothing about how and where you wish to generate the output reports - PDF, web, etc. -- please share more info (ideally your SAS code) which renders some output, if no more than to explain what / where you would like the output to be delivered?

Scott Barry
SBBWorks, Inc.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 599 views
  • 0 likes
  • 3 in conversation