DATA Step, Macro, Functions and more

sql or report

Reply
Super Contributor
Posts: 673

sql or report

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.
Super Contributor
Super Contributor
Posts: 3,174

Re: sql or report

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.
Ask a Question
Discussion stats
  • 1 reply
  • 102 views
  • 0 likes
  • 2 in conversation