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 (May 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 6 May 2004 12:07:28 -0400
Reply-To:   Mark Biek <markb@STEVENSONCOMPANY.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Mark Biek <markb@STEVENSONCOMPANY.COM>
Subject:   Re: Best way to combine 2 columns of data into 1 column
Comments:   To: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
In-Reply-To:   <200405061606.i46G62424001@listserv.cc.uga.edu>
Content-Type:   text/plain; charset=us-ascii; format=flowed

Chang- Exactly what I was looking for.

Thanks! Mark

Chang Y. Chung wrote:

> On Thu, 6 May 2004 11:53:23 -0400, Mark Biek <markb@STEVENSONCOMPANY.COM> > wrote: > > >>I have a dataset that has the following columns: >>ID Q8 Q9 >> >>I'm trying to come up with something so that I end up with a dataset >>with a single column for all values of Q8 & Q9. I though proc transpose >>might do it but I haven't had much luck that way. >> >>What's the easiest way to combine the contents of 2 columns to make 1 >>column that has all values from both? >> > > Hi, Mark, > > There are many, many ways to this. I am afraid I don't know why one is the > easiest. Here is one of the ways. > > Cheers, > Chang > > /* test data */ > data old; > id=1; q8=1; q9=10; output; > id=2; q8=2; q9=20; output; > run; > > /* a solution */ > data new; > set old(keep=id q8 rename=(q8=q)) > old(keep=id q9 rename=(q9=q)) > ; > run; > > /* check */ > proc print data=new; > run; > > /* on lst > Obs id q > > 1 1 1 > 2 2 2 > 3 1 10 > 4 2 20 > */ >

-- Mark Biek The Stevenson Company 8700 Westport Rd. Ste. 200 Louisville, KY 40242-3100 (502) 429-9060 ext 251


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