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 2004, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 29 Jan 2004 11:33:30 GMT
Reply-To:     julierog@ix.netcom.com
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Roger Lustig <trovato@VERIZON.NET>
Subject:      Re: simple output depending on variable
Content-Type: text/plain; charset=us-ascii; format=flowed

Dear Doug: You're on the right track.

data new(drop=rels: j slice); set old; array rels(144) relate_1 - relate_144; array item(12); slice=-12; do ID2=1 to 12; slice + 12; do j=1 to 12; item(J)=rels(slice + j); end; output; end; run;

OK?

Roger

dg wrote: > I have a dataset that contains id, relate_1 to relate_144. Each value of > relate_1 to relate_144 is numeric. Id = character. > > I would like to create a new dataset that has the following items; > id, id2, item1 - item12. > > where > id =id, id2=1, item1-item12 = relate_1 to relate_12 for the relate_1 to > relate_12 variables, > id=id, id2=2, item1-item12 = relate_13 to relate_24 for the next 12 relate > variables etc down to ..... > > id=id, id2=12, item1-item12=relate 131 to relate_144 for the last 12 relate > variables > and so on. > > This is what I have tried.. > data new; > set old; > array rels(144) relate_1 - relate_144; > array item(12); > do h=1 to 12; > do i = h to 144 by 12; > item(h)=rels(i); > output; > end; > end; > run; > > but this doesn't give me what I want. I suppose I want a vertical slice > after each 12 relate variables and the number of the slice in a vertical > file. > > Any help appreciated. > > Doug > > >


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