LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (February 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 1 Feb 2010 10:15:32 -0600
Reply-To:     Yu Zhang <zhangyu05@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Yu Zhang <zhangyu05@GMAIL.COM>
Subject:      Re: URGENT: Help me in transpose
Comments: To: Amar Mundankar <amarmundankar@gmail.com>
In-Reply-To:  <5a21ec58-40f1-4eb6-9706-5de92ef6b122@y7g2000prc.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

Is this what you want? data have; input PFAM_CD_PRIMO $ FTF_DRUG_NAME &$50. PLTK_PLAN_ID $ BNFT_DSGN $ ; n=_n_; cards; ALD Avalide 2200003 T3 AXR Adderall XR 2200001 T3 DPE Depakote ER 2200001 T3 FVR Famvir 2200003 T3 LIP Lipitor 2200003 T2 NA Renagel 2200001 NC NA Renagel 2200007 T2 NA Renagel 2200003 NC NA Renagel 2200002 T1 NA Renagel 2200007 T3 NA Renagel 2200007 NC NA Renagel 2209999 T1 NA Aldara 2200001 NC NA Aldara 2200007 T2 NA Aldara 2200003 NC NA Aldara 2200002 T1 NA Aldara 2200007 T3 NA Aldara 2200007 NC NA Aldara 2209999 T1 NA Metaproterenol Nebulizer 2200001 NC ; run;

data have1; set have; drugname=catx('_',FTF_DRUG_NAME,'BD'); run;

proc sort data=have1; by PFAM_CD_PRIMO PLTK_PLAN_ID; run;

proc transpose data=have1 out=want1; by PFAM_CD_PRIMO PLTK_PLAN_ID n; id drugname; var BNFT_DSGN; run;

proc sort data=want1 out=want(drop=n _name_); by n; run;

On Mon, Feb 1, 2010 at 8:25 AM, Amar Mundankar <amarmundankar@gmail.com>wrote:

> Hi all, > I have been trying it for past few days. still didnt get the complete > solution. > Pleas help me..... > Thanks in Advance. > > > I have input dataset as : > > PFAM_CD_PRIMO FTF_DRUG_NAME PLTK_PLAN_ID BNFT_DSGN > > ALD Avalide 2200003 T3 > AXR Adderall XR 2200001 T3 > DPE Depakote ER 2200001 T3 > FVR Famvir 2200003 T3 > LIP Lipitor 2200003 > T2 > NA Renagel 2200001 NC > NA Renagel 2200007 > T2 > NA Renagel 2200003 > NC > NA Renagel 2200002 > T1 > NA Renagel 2200007 > T3 > NA Renagel 2200007 > NC > NA Renagel 2209999 > T1 > NA Aldara 2200001 > NC > NA Aldara 2200007 > T2 > NA Aldara 2200003 > NC > NA Aldara 2200002 > T1 > NA Aldara 2200007 > T3 > NA Aldara 2200007 > NC > NA Aldara 2209999 > T1 > NA Metaproterenol Nebulizer 2200001 NC > > In the output, > > 1) for each FTF_DRUG_NAME value there should be a separate column (if > the value contains space in between then it should be replaced by '_ ' > i.e. underscore and in the end the column name should be appended with > '_BD'. ) > e.g For the value as Adderall XR , a column should be created as > Adderall_XR_BD. > > 2) If there are duplicate values for FTF_DRUG_NAME, then only one > column should be created. > e.g. In case of value Renagel, there are total 7 values, but only > one column Renagel_BD should be created. > > 3) Columns will be created for the values of FTF_DRUG_NAME column by > appending '_BD' to every column. > And these newly created columns will contain the values of > respective BNFT_DSGN column. > > output will be as follows : > > column names #1 PFAM_CD_PRIMO PLTK_PLAN_ID Avalide_BD > Adderall_ XR_BD > #2 Depakote_ER_BD Famvir_BD > Lipitor_BD Renagel_BD > > #3 Aldara_BD > Metaproterenol_Nebulizer_BD > > obs1:#1 ALD 2200003 > T3 #2 > #3 > > obs2:#1 AXR 2200001 > T3 > #2 > #3 > > obs3:#1 DPE 2200001 > #2 T3 > #3 > > obs4:#1 FVR 2200003 > #2 T3 > #3 > > obs5:#1 LIP 2200003 > #2 > T2 > #3 > > obs6:#1 NA 2200001 > #2 > NC > #3 > > 0bs7:#1 NA 2200007 > #2 T2 > #3 > > obs8: #1 NA 2200003 > #2 NC > #3 > > obs9:#1 NA 2200002 > #2 > T1 > #3 > > > obs10:#1 NA 2200007 > #2 > T3 > #3 > > > obs11:#1 NA 2200007 > #2 > NC > #3 > > > 0bs12:#1 NA 2209999 > #2 T1 > #3 > > Obs13:#1 NA 2200001 > #2 > #3 NC > > Obs14:#1 NA 2200007 > #2 > #3 T2 > > Obs15:#1 NA 2200003 > #2 > #3 NC > > Obs16:#1 NA 2200002 > #2 > #3 T1 > > > Obs17:#1 NA 2200007 > #2 > #3 T3 > > > Obs18:#1 NA 2200007 > #2 > #3 NC > > Obs19:#1 NA 2209999 > #2 > #3 T1 > > Obs20:#1 NA 2200001 > #2 > #3 NC > > I will be very thankful... > > Regards, > Amar Mundankar. >


Back to: Top of message | Previous page | Main SAS-L page