Date: Fri, 30 Mar 2012 11:31:00 -0400
Reply-To: Kathyrn Centar <kcentar03@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kathyrn Centar <kcentar03@GMAIL.COM>
Subject: Column to row problem
Content-Type: text/plain; charset=ISO-8859-1
I have data that looks like the following:
ID CODE YEAR
1 70 2011
1 29 2011
1 35 2012
2 12 2011
2 10 2012
3 13 2011
I want it to look like this:
ID YEAR TSC10 TSC12 TSC13 TSC29 TSC35
TSC70
1
2011
Y Y
1
2012
Y
2 2011
Y
2 2012
Y
3 2011
Y
I've tried various arrays, loops and first. variables but I can't seem to
get it to work.
I did this before I found out I needed to keep the year breakouts and it
worked but now I need to add the year breakouts and I'm not having any
success.
**
*proc sort data=test;*
* by id;*
*run;*
*data* test3;
array TSC {*177*}$ tsc1-tsc90;
do _i = *1* to 90 until (last.id);
set test ;
by id;
tsc(code) = "Y";
if last.id then output;
end;
*run*;