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 2012, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 15 Feb 2012 10:03:32 -0500
Reply-To:     Nat Wooding <nathani@VERIZON.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <nathani@VERIZON.NET>
Subject:      Re: combine two variables into one
In-Reply-To:  <201202151434.q1F5ahMI030171@waikiki.cc.uga.edu>
Content-Type: text/plain; charset="US-ASCII"

Soumi

Here are two solutions. The one using Proc transpose does not require that you write out all of the names of the variables that you want to work with. You could also write the second method using an array and a do loop.

Nat Wooding

Data start; input AL KL; cards; 1 5 2 6 3 7 4 8 ; Proc Transpose data = start out = want (rename = ( Col1 = LM) Keep = col1); by al; var _numeric_; run; Data Want2; set start; keep LM; LM = AL; Output; LM = Kl; output; run;

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Soumi Ray Sent: Wednesday, February 15, 2012 9:35 AM To: SAS-L@LISTSERV.UGA.EDU Subject: combine two variables into one

Hello,

I have a dataset like this: AL KL 1 5 2 6 3 7 4 8

I want a new variable which will be: LM 1 5 2 6 3 7 4 8

Could anyone please help?

Thanks

Soumi


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