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 (February 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 18 Feb 2005 13:12:49 -0500
Reply-To:     "Michael S. Zdeb" <msz03@HEALTH.STATE.NY.US>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Michael S. Zdeb" <msz03@HEALTH.STATE.NY.US>
Subject:      Re: restore the original id var after second transpose ?
Comments: To: Ya Huang <ya.huang@AMYLIN.COM>
Content-type: text/plain; charset=US-ASCII

Hi...I added an IDLABEL statement...

data xx; input id t v; cards; 1 -0.5 34 1 0 56 1 0.2 34 1 1 67 1 2 78 1 4 23 2 -0.5 34 2 0.2 76 2 1 87 2 2 22 2 5 11 ;

proc transpose data=xx out=yy; by id; id t; idlabel t; var v; run;

proc transpose data=yy out=zz (rename=(_label_=t) drop=_name_); by id; run;

proc print data=zz run;

Student Test Scores Obs id t v 1 1 -0.5 34 2 1 0 56 3 1 0.2 34 4 1 1 67 5 1 2 78 6 1 4 23 7 1 5 . 8 2 -0.5 34 9 2 0 . 10 2 0.2 76 11 2 1 87 12 2 2 22 13 2 4 . 14 2 5 11

Mike Zdeb U@Albany School of Public Health 1 University Drive Rensselaer, NY 12144-3456 (P)518-402-6479 (F)630-604-1475

|---------+----------------------------> | | Ya Huang | | | <ya.huang@AMYLIN.| | | COM> | | | Sent by: "SAS(r) | | | Discussion" | | | <SAS-L@LISTSERV.U| | | GA.EDU> | | | | | | | | | 02/18/2005 01:01 | | | PM | | | Please respond to| | | Ya Huang | | | | |---------+----------------------------> >----------------------------------------------------------------------------------------------------------------------| | | | To: SAS-L@LISTSERV.UGA.EDU | | cc: | | Subject: restore the original id var after second transpose ? | >----------------------------------------------------------------------------------------------------------------------|

Hi there,

data xx; input id t v; cards; 1 -0.5 34 1 0 56 1 0.2 34 1 1 67 1 2 78 1 4 23 2 -0.5 34 2 0.2 76 2 1 87 2 2 22 2 5 11 ;

proc transpose data=xx out=yy; by id; id t; var v; run;

proc transpose data=yy out=zz; by id; run;

proc print; run;

Obs id _NAME_ v

1 1 N0D5 34 2 1 _0 56 3 1 _0D2 34 4 1 _1 67 5 1 _2 78 6 1 _4 23 7 1 _5 . 8 2 N0D5 34 9 2 _0 . 10 2 _0D2 76 11 2 _1 87 12 2 _2 22 13 2 _4 . 14 2 _5 11

Is there a straightforward way to get back the original var 't' ? I can extract it from _name_ with a predefined informat. But I'm afraid that I may miss some cases.

Thanks

Ya


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