BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8
The data set has the following variables:

Last_Name First_Name City State Zip GHTM date drug mg_dispensed


1.date has the values from Jan 2008 and is in the format date9.
2.drug has two categories:
Competitor and Nordi.
3.Mg_dispensed is the mg dispensed for drug numeric.





output:
Last_Name First_Name City State Zip GHTM Q1_09_Total_mg Q1_09_Nordi Q2_09_Total_mg Q2_09_Nordi....Q1_08_Total_mg Q1_08_Nordi_mg
John Peter abc pq 12345 JSEQ 36542 24.3%




in the output:

Q1_09_Total_mg is the total mg dispensed by the physician i.e sum of competitor and Nordi in the first qtr of 09.
Q1_09_Nordi is the total nordi share in the first qtr of 09.


Actually , the quarters appear from current qtr ,(2009 second qtr) to 2008 all four qtrs in the report.
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
From your SUBJECT, it appears that you are looking for feedback on which approach to take - that being "PROC SQL or PROC REPORT"?

Of course, a DATA step approach allows ultimate flexibility, however a combination of PROC TRANSPOSE and PROC REPORT (or maybe only PROC REPORT with ACROSS, but maybe not with those desired column headings you show) would do the job.

Scott Barry
SBBWorks, Inc.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1 reply
  • 936 views
  • 0 likes
  • 2 in conversation