[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Re: Proc Transpose Problem
From: Nat Wooding <Nathaniel.Wooding () DOM ! COM>
Date: 2008-05-31 20:29:30
Message-ID: OF2F1F3F63.629F2F8C-ON8525745A.0070862F-8525745A.00708E77 () dom ! com
[Download RAW message or body]
Sudip
A double transpose will do this readily.
data trans;
input place_id Year Race X Y Z ;
cards;
1 1950 1 1 1 1
1 1950 2 1 1 1
proc transpose ;
var x y z;
by place_id year race;
Data trans;
set;
id = catx( '_' , _name_ , race );
drop race;
run;
Proc transpose out = trans (drop = _name_ ) ;
id id;
var col1;
by place_id year;
proc print;
run;
Nat Wooding
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
sudip chatterjee
<sudip.memphis@GM
AIL.COM> To
Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
Discussion" cc
<SAS-L@LISTSERV.U
GA.EDU> Subject
Proc Transpose Problem
05/31/2008 01:59
PM
Please respond to
sudip chatterjee
<sudip.memphis@GM
AIL.COM>
My data set has place_ ID , Race , and several variables like X,Y,Z during
1950 - 1990.
like
place_ id Year Race X Y Z
1 1950 1 1 1 1
1 1950 2 1 1 1
Now what I want is
Place_id Year X_1 X_2 Y_1 Y_2 Z_1 Z_2
I got these by using
proc transpose data=mydata out=new(drop=_name_) prefix=
X;
by place_id year
;
var X ;
run;
*** But this is only for 1 variable ******
My problem : IF I want to do the same for all the variables (X,Y,Z) in the
same table at once
then how ?
-----------------------------------------
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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic