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