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 (July 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 12 Jul 2004 23:50:09 -0400
Reply-To:     "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject:      Re: Multiple  Proc transpose question

taran Singh wrote: > Hi folks: > > I am transposing a dataset and i need to transpose it for three > different values . How can i accomplish that with one proc transpose > with control on the names . > > this is what i am doing : > > proc transpose data = SKU_CSV_REPORT out = test1(drop = _name_ > _label_) prefix = size ; by style_color_mkt week_num; > id size_code ; > var stockout_percent ; > run; > > proc transpose data = SKU_CSV_REPORT out = test11(drop = _name_ > _label_) ) prefix = size_s ; by style_color_mkt week_num; > id size_code ; > var sku_stk ; > run; > proc transpose data = SKU_CSV_REPORT out = test13(drop = _name_ > _label_)) prefix = size_s ; by style_color_mkt week_num; > id size_code ; > var sku_total ; > run; > and i am merging the output data sets . >

As you have found TRANSPOSE will not transpose parallel columns into a single row.

Another way to mimic Proc TRANSPOSE is to use data step with arrays and looping. The way you have shown is probably the most clear. An important question is why ? If for reporting purposes, perhaps REPORT or TABULATE would be a better vehicle.

A suggestion to send to suggest@sas.com is thus: Improve Proc TRANSPOSE to allow tranposition of parallel columns into a single row when ID is active. This would be accomplished by requiring one PREFIX per VAR. Perhaps a new option PPREFIX to indicate Parallel PREFIX. e.g. Proc transpose data=foo out=bar prefix=(colgroup1,colgroup2,colgroup3); by by1 by2; id id; var var1 var2 var3; run;

the columns of bar would be by1 by2 _name_ _label_ colgroup1<idval1> colgroup2<idval1> colgroup3<idval2> ... colgroup3<idvalN>; wherein _name_ = .multiple. _label_ = .multiple. value of colgroup1<idval1> would be from column var1 of row having by1 by2 idval1.

-- Richard A. DeVenezia


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