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 (March 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 27 Mar 2006 11:12:34 -0500
Reply-To:   Nathaniel_Wooding@DOM.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Nat Wooding <Nathaniel_Wooding@DOM.COM>
Subject:   Re: transpose help
Comments:   To: Ran S <raan67@YAHOO.COM>
In-Reply-To:   <200603271600.k2RBnfZU010017@malibu.cc.uga.edu>
Content-Type:   text/plain; charset="US-ASCII"

Ran

This is untested code but should be close.

Proc transpose out = a; var RACE_T RACE_S RACE_R; by statee race_id; run;

Data a; set a; _name_=compress(_name_|| race_id);

proc transpose out=a; var col1; id _name_; by stateee;

run;

strictly speaking, you should not need the id and var stmts in the last transpose but I threw them in anyway.

Nat Wooding

Ran S <raan67@YAHOO.COM > To Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU Discussion" cc <SAS-L@LISTSERV.U GA.EDU> Subject transpose help

03/27/2006 11:00 AM

Please respond to Ran S <raan67@YAHOO.COM >

Hi,

I have a data which has data as below:

STATEE RACE_ID RACE_T RACE_S RACE_R AR 55 0 0 0 AR 56 0 0 0 AR 57 0 0 0 AR 59 0 0 0 AR 60 0 0 0 AR 61 0 0 0 AR 62 0 0 0 AR 116 0 0 0 AR 117 0 0 0 AS 55 0 0 0 AS 56 1 1 0 AS 57 0 0 0 AS 59 2154 875 1279 AS 60 9 0 9 AS 61 0 0 0 AS 62 0 0 0 AS 116 0 0 0 AS 117 0 0 0 ............

I would like to have one record per state. So that I have data something like this:

State Race_T55 race_T56 race_T57 Race_T59 race_T60 ...race_S55 race_R56.. AR 0 0 0 0 0 0 0 AS 0 1 0 2154 9 ....

How can I transpose and create new variables? I would appreciate your help.

Thanks!

----------------------------------------- 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