Date: Wed, 16 Apr 2008 15:55:13 -0400
Reply-To: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject: Re: How to use lookup function to merge data from a standard list
file
In-Reply-To: <055601c89ff9$8a2e91c0$832fa8c0@HP82083701405>
Content-Type: text/plain; charset=ISO-8859-1
Or just do this:
data mergeset;
merge data1 data2;
run;
And avoid some completely unnecessary I/O.
On Wed, Apr 16, 2008 at 3:39 PM, Mary <mlhoward@avalon.net> wrote:
> I think that what you mean is that you have two data sets with an equal number of rows that you want to merge together, and they match row for row, but you don't have an ID field on data 1.
>
> Try this:
>
> data data1;
> obsnum + 1;
> run;
>
> data data2;
> obsnum + 1;
> run;
>
> data mergeset;
> merge data1 data2;
> by obsnum;
> run;
>
> -Mary
>
> ----- Original Message -----
> From: jn mao
> To: SAS-L@LISTSERV.UGA.EDU
> Sent: Wednesday, April 16, 2008 2:27 PM
> Subject: How to use lookup function to merge data from a standard list file
>
>
> Hello SAS-Ls,
>
> I have a standard list file with 100 category. And I have another data2 file with all subjects. In data2, var2 need be matched to the list file, and find the category it belongs.
>
> data1 (list file):
> var1 category
> aa 1
> bb 1
> cc 2
>
> data2:
> Id var2
> 1 aa
> 2 cc
> 3 bb
>
> I need add category to data2. When I tried use merge, I lost all ID data which means all ID data become missing.
> Could someone help me to add the category in data2? Thanks much.
>
> Jane
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
>
|