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 (May 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 15 May 2002 09:50:18 -0400
Reply-To:     Kevin Viel <kviel@EMORY.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Kevin Viel <kviel@EMORY.EDU>
Subject:      Re: How to check values of a variable before Proc Transpose
Content-Type: text/plain; charset=us-ascii

Mohan wrote: > > Hi > I would greatly appreciate if someone could give me a suggestion to > overcome this issue. > > Dataset: Test > > Drug sngl mtpl > A 2 3 > B 3 2 > C 2 2 > > I use the following code to transpose the data > > PROC TRANSPOSE DATA=test OUT=TRAN_tst(RENAME=(_NAME_= PARM a=a_CRD b=b_CRD > c=c_CRD) > DROP=_LABEL_); > ID DRUG; > VAR SNGL MTPL; > RUN;

Mohan,

There will be several solutions, including using the SASHELP library. However, the most apparent to me is the use of SQL:

Data Test; input Drug $ sngl mtpl; cards; A 2 3 B 3 2 C 2 2 ; run;

proc sql noprint; select trim(left(drug))||"="||trim(left(drug))||"_CRD" into :list separated by " " from test ; quit;

%put &list;

Thus you can change to:

> PROC TRANSPOSE DATA=test OUT=TRAN_tst(RENAME=(_NAME_= PARM &list) ^^^^^

Regards,

Kevin

--------------------------------- Kevin Viel Department of Epidemiology Rollins School of Public Health Emory University Atlanta, GA 30322


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