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 (February 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 14 Feb 2005 17:48:26 -0500
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: Data Transpose question

Why do you want to do that? The resulting data set will be clumsy and complicated for almost any imaginable use.

Having said that, here is a double transpose model:

data have; input key1 $ key2 $ ws1-ws3; cards; 11 21 111 112 113 11 22 121 122 123 12 21 211 212 213 12 22 221 222 223 ;

proc transpose data=have out=long; by key1 key2; var ws1-ws3; run;

data fortransp; set long; _name_ = trim(_name_) || '_' || key2; run;

proc transpose data=fortransp out=like(drop=_name_); by key1; run;

On Mon, 14 Feb 2005 15:04:36 -0500, Shukla Kshirsagar <shuklak@HOTMAIL.COM> wrote:

>Hello everybody, > >I have a data set that looks like this, and has values of missing or >greater than zero for weeklysales 1-7, Key2 has values from 1-8, Key1 has >values from 1-5: > >Key1 Key2 WeeklySales1............ WeeklySales7 > 1 1 > 1 2 > 2 7 > >I would like the final dataset to look like below, with 5 rows represnting >5 values for Key1: > >Key1 Weeklysales1Key2=1..... Weeklysales7Key2=1 WeeklySales1Key2=2.... > >where the column names would be a combination of WeeklySales1-7 and Key2 >(ranges from 1-8). > >Thanks for your help. > >Regards, >Shukla


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