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 (January 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 8 Jan 2009 15:54:11 -0500
Reply-To:   Akshaya Nathilvar <akshaya.nathilvar@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Akshaya Nathilvar <akshaya.nathilvar@GMAIL.COM>
Subject:   Re: Change the alignment of the data and create a data set
Comments:   To: sasbeginner <pattukuttani@gmail.com>
In-Reply-To:   <1fecdd39-a2fa-44fe-ba98-2216b9ec8042@a12g2000yqm.googlegroups.com>
Content-Type:   text/plain; charset=ISO-8859-1

Data have; infile cards dlm=' /'; input U_id t_id s_code d y sales returns; if y=08 then do; /* If you have data for different years */ if d=01 then do; Sale_Jan08=sales; Retn_Jan08=returns; end; else if d=02 then do; Sale_Feb08=sales; Retn_Feb08=returns;end; else if d=03 then do; Sale_Mar08=sales; Retn_Mar08=returns; end; end; keep u_: t_: s_: sale_: retn:; cards; 1 1 1 01/08 100 100 1 1 1 02/08 200 200 1 1 1 03/08 300 300 2 2 2 01/08 120 123 2 2 2 02/08 160 159 3 3 3 03/08 111 111 ;

Data want; update have(obs=0) have; by u_id t_id s_code; Run;

Thanks! Akshaya

On Thu, Jan 8, 2009 at 12:52 PM, sasbeginner <pattukuttani@gmail.com> wrote:

> Hi All, > > Basically I need to transpose it. Any thoughts on this?. I have > intellects of this group who has helped me with renaming hte > variables. Now the basic data set itself is different. How to do > this?? Please help someone like me who has 0 programming knowledge? > > I appreciate everyone's hard work and time. Thanks and hats off to you > guys > > Thanks a lot. > > Input data: > > U_id t_id s_code date sales returns > 1 1 1 01/08 100 100 > 1 1 1 02/08 200 200 > 1 1 1 03/08 300 300 > 2 2 2 01/08 120 123 > 2 2 2 02/08 160 159 > 3 3 3 03/08 111 111 > > > output > > U_ID t_id s_code sales_mar08 sales_feb08 sales_jan08 > returns_mar08 > returns_feb08 returns_jan08 > 1 1 1 300 200 100 300 200 100 > 2 2 2 --- 160 120 --- 159 123 > 3 3 3 111 --- --- 111 --- --- >


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