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 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 24 Nov 2004 10:16:34 -0800
Reply-To:     Dennis Diskin <diskin@SNET.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Dennis Diskin <diskin@SNET.NET>
Subject:      Re: transpose in a non-usual way
Comments: To: jlamack <jlamack@BOL.COM.BR>
In-Reply-To:  <I7P1C5$0F527AA54D4D03A94B491C6DD95BCA4C@bol.com.br>
Content-Type: text/plain; charset=us-ascii

J.,

Here's one method. I just used character variables because that's what was in your sample. You can easily adapt it to numeric. Basically, I split thedata in two and combine it back together in order to be able to drop the duplicates.

HTH, Dennis Diskin

data input; input _type_ $7. var1 $2. var2 $2.; cards; COv2: H a b COv2: H b c COv2: H e f COv2: H f g ; run;

proc sort data=input(drop=var2) out=out1(rename=var1=var); by _type_ var1; run;

proc sort data=input(drop=var1) out=out2(rename=var2=var); by _type_ var2; run;

data comb (drop=i var); set out1 out2; by _type_ var; array new(3) $2; retain new1-new3; if first.var then do; i+1; new(i) = var; end; if i eq 3 or last._type_; output; do i = 1 to 3; new(i) = ''; end; i = 0; run;

jlamack <jlamack@BOL.COM.BR> wrote: Dear all, I have a sas-data-set like bellow:

_type_ var1 var2 _____________________________ COv2: H a b COv2: H b c COv2: H e f COv2: H f g . . . . . . _______________________________ where var1 and var2 are numeric variables.

How can I get another sas-data-set as bellow:

new1 new2 new3 a b c e f g . . .

Best regards.

J. Lamack

__________________________________________________________________________ Acabe com aquelas janelinhas que pulam na sua tela. AntiPop-up UOL - É grátis! http://antipopup.uol.com.br/


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