| Date: | Mon, 10 May 2004 18:34:49 +0100 |
| Reply-To: | "Ravikumar. J" <ravi_pune@YAHOO.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
|
| From: | "Ravikumar. J" <ravi_pune@YAHOO.COM> |
| Subject: | Re: Best way to combine 2 columns of data into 1 column |
|
| In-Reply-To: | <1084206336.14029.196181661@webmail.messagingengine.com> |
| Content-Type: | text/plain; charset=iso-8859-1 |
Hello,
You could probably achieve what you want to do with this ...
----------------------------------------------------
data one;
input Q8 $;
cards;
q8string1
q8string2
q8string3
;
run;
data two;
input Q9 $;
cards;
q9string1
q9string2
q3string3
;
run;
data three;
set one two(rename=(q9=q8));
run;
----------------------------------------------------
Cheers
Ravi
--- SAS Bigot <sas_bigot@ML1.NET> wrote: > If you need to preserve
duplicate values in those columns, then use
> UNION
> ALL as the set operator.
>
>
> ----- Original message -----
> From: "Steve Basford" <sbasford@HR.OSU.EDU>
> To: SAS-L@LISTSERV.UGA.EDU
> Date: Sun, 9 May 2004 08:50:19 -0400
> Subject: Re: Best way to combine 2 columns of data into 1 column
>
> How about ...
>
> proc sql;
> create table new as
> select Q8 as new_column
> from old
> union
> select Q9
> from old;
> quit;
>
>
> Mark Biek wrote:
>
> > Ed-
> > Q8 and Q9 are both strings.
> >
> > Let's pretend the data looks like this:
> >
> > Q8 Q9
> > -- --
> > q8string1 q9string1
> > q8string2 q9string2
> > q8string3 q3string3
> >
> > I need a dataset that looks like this:
> >
> > --
> > q8string1
> > q8string2
> > q8string3
> > q9string1
> > q9string2
> > q9string3
> >
> > Hopefully that's more clear.
> >
> > Mark
> >
> > Ed Heaton wrote:
> >
> > > Mark,
> > >
> > > You're pretty vague here. Are the numbers character or
> numeric? You could
> > > use
> > >
> > > Q8Q9 = Q8 + Q9 ;
> > >
> > > or
> > >
> > > Q8Q9 = trim(Q8) || Q9 ;
> > >
> > > or
> > >
> > > Q8Q9 = 100 * Q8 + Q9 ;
> > >
> > > or
> > >
> > > Q8Q9 = Q8 + Q9/100 ;
> > >
> > > or
> > >
> > > Data ... ;
> > > Set ... ;
> > > Q8Q9 = Q8 ; Output ;
> > > Q8Q9 = Q9 ; Output ;
> > > Run ;
> > >
> > > I don't have a clue what you want.
> > >
> > > Ed
> > >
> > > -----Original Message-----
> > > From: Mark Biek [mailto:markb@STEVENSONCOMPANY.COM]
> > > Sent: Thursday, May 06, 2004 11:53 AM
> > > To: SAS-L@LISTSERV.UGA.EDU
> > > Subject: Best way to combine 2 columns of data into 1 column
> > >
> > >
> > > 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?
> > >
> > > Mark
> > > --
> > > Mark Biek
> > > The Stevenson Company
> > > 8700 Westport Rd. Ste. 200
> > > Louisville, KY 40242-3100
> > > (502) 429-9060 ext 251
> > >
> >
> > --
> > Mark Biek
> > The Stevenson Company
> > 8700 Westport Rd. Ste. 200
> > Louisville, KY 40242-3100
> > (502) 429-9060 ext 251
>
> --
> http://www.fastmail.fm - Access your email from home and the web
________________________________________________________________________
Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/
|