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.

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