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 (June 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 22 Jun 2009 10:28:29 -0400
Reply-To:   Nathaniel.Wooding@DOM.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Nat Wooding <Nathaniel.Wooding@DOM.COM>
Subject:   Re: please help me do in a simple way instead of using several data steps
In-Reply-To:   <801147c6-03b5-474a-b12d-b9e1aea4b889@y9g2000yqg.googlegroups.com>
Content-Type:   text/plain; charset="US-ASCII"

Although you could do this with an array or simply a set of output statements, I agree with Karma that Proc Transpose is a simple way to go.

Here are two additional ways to code the proc. The primary differences are in the way the Var statement is written.

data have; input subj pulse temp height weight; cards; 101 64 36 174 68 102 67 36.4 182 72 proc print; run;

Proc Transpose data = have out = wanted ( rename = ( col1= newval _name_ = newvar )); var pulse temp height weight; by subj; run; proc print; run;

* alternative ;

Proc Transpose data = have out = wanted ( rename = ( col1= newval _name_ = newvar ) where = ( newvar ne 'subj')); var _numeric_ ; by subj; run;

Nat Wooding Environmental Specialist III Dominion, Environmental Biology 4111 Castlewood Rd Richmond, VA 23234 Phone:804-271-5313, Fax: 804-271-2977 Cel Phone: 804-205-0752

kasa <venkatrkasa@GMAI L.COM> To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion" cc <SAS-L@LISTSERV.U GA.EDU> Subject please help me do in a simple way instead of using several data 06/22/2009 10:17 steps AM

Please respond to kasa <venkatrkasa@GMAI L.COM>

Currently i am using several data steps in order to derive needed data set. can you please help me to do it efficiently.

data have subj pulse temp height weight 101 64 36 174 68 102 67 36.4 182 72

data needed subj newvar newval 101 pulse 64 101 temp 36 101 height 174 101 weight 68 102 pulse 67 102 temp 36.4 102 height 182 102 weight 72

CONFIDENTIALITY NOTICE: This electronic message contains information which may be legally confidential and or privileged and does not in any case represent a firm ENERGY COMMODITY bid or offer relating thereto which binds the sender without an additional express written confirmation to that effect. The information is intended solely for the individual or entity named above and access by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.


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