LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (November 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 24 Nov 2008 12:00:54 -0800
Reply-To:     Al <ali6058@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Al <ali6058@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: AE Table --Datastructure
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On Nov 24, 12:31 pm, dorjeta...@GOOGLEMAIL.COM (karma) wrote: > HTH > > data have; > retain _x; > infile cards missover; > input label$ Grade1 Grade2; > if label=:'SOC' then _x=label; > cards; > SOC1 > X1 1 3 > X2 2 5 > X3 3 1 > SOC2 > X4 3 5 > X5 4 1 > X6 5 7 > SOC3 > X7 4 2 > X8 4 2 > X9 9 1 > ;run; > > data want(drop=_:); > do _i=1 by 1 until(last._x); > set have; > by _x; > _G1=sum(0,_G1,Grade1); > _G2=sum(0,_G2,Grade2); > end; > label = _x; > Grade1 = _G1; > Grade2 = _G2; > output; > do _n_=1 to _i; > set have; > if label ^=:'SOC' then output; > end; > run; > proc print;run; > > 2008/11/24 Al <ali6...@gmail.com>: > > > > > I have the datastructure in the following format > > > Grade1 Grade2 > > SOC1 > > X1 1 3 > > X2 2 5 > > X3 3 1 > > SOC2 > > X4 3 5 > > X5 4 1 > > X6 5 7 > > SOC3 > > X7 4 2 > > X8 4 2 > > X9 9 1 > > > , I am trying to calculate the SOC row > > by adding the aeterms under them and by grade. Any suggestions > > The output should look like > > > Grade1 Grade2 > > SOC1 6 9 > > X1 1 3 > > X2 2 5 > > X3 3 1 > > SOC2 12 13 > > X4 3 5 > > X5 4 1 > > X6 5 7 > > SOC3 17 5 > > X7 4 2 > > X8 4 2 > > X9 9 1 > > > Thanks in advance- Hide quoted text - > > - Show quoted text -

Hi Karma , works good on example data tried on real data i am getting wrong counts !! any other solution please Thanks for your help


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