LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 21 Jan 2010 12:42:14 +0100
Reply-To:     Andre Wielki <wielki@INED.FR>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Andre Wielki <wielki@INED.FR>
Subject:      Re: how to transpose two varaibles in datastep by using arrays?
Comments: To: Shaik Hymad <hymadsk@GMAIL.COM>
In-Reply-To:  <201001211104.o0L70BE1014579@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

one possible way :

proc transpose data=gas(drop=ms) out=sag1(drop=_name_) prefix=hs ; var hs ; by patid vrd; run; proc transpose data=gas(drop=hs) out=sag2(drop=_name_) prefix=ms ; var ms ; by patid vrd; run; data c;merge sag1 sag2; by patid vrd; run;

HTH Andre

Shaik Hymad a écrit : > Hi To all; > > I have datalike > > patid vrd seq hs ms > 1001 0 1 100 229 > 1001 0 2 101 341 > 1001 0 3 102 123 > 1001 1 1 120 249 > 1001 1 2 121 141 > 1001 1 3 132 153 > > and soon............ upto n subjects > > hs and ms are char varaibles > > i want output like > > patid vrd hs1 hs2 hs3 ms1 ms2 ms3 > 1001 0 100 101 102 229 341 123 > 1001 1 120 121 132 249 141 153 > > > > Im writing a code inarrays > > but it not works > > data g1; > set gas; > by patid vorder; > array h[3] $ hs1 hs2 hs3; > array m[3] $ ms1 ms2 ms3; > if first.patid then do; > hs1=''; > hs2=''; > hs3=''; > ms1=''; > ms2=''; > ms3=''; > end; > h[vorder]=hs; > m[sampseq]=ms; > if last.patid; > run; > > can you please help me out this > > Thanks, > Hymad > >

-- André WIELKI INED (Institut National d'Etudes Démographiques) Service Informatique 133 Boulevard Davout 75980 Paris Cedex 20 mél : wielki@ined.fr tél : 33 (0) 1 56 06 21 54


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