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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 617 views
  • 0 likes
  • 2 in conversation