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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 834 views
  • 0 likes
  • 3 in conversation