|
Jason,
Along with the suggestions so far, you can also use a lookup table. Quick
example:
data newdata ;
set a ;
do Loop = 1 to Number_of_Records;
set b nobs=Number_of_Records point=Loop;
if id_a = id_b then
do ;
...do your work here.... ;
leave ;
end ;
end;
run;
Keep in mind that you are reading b every time a record in a is processed.
The number of records in b read is dependent on where it occurs.
Thanks,
Alan
Savian
"Bridging SAS and Microsoft Technologies"
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Jason
Shen
Sent: Tuesday, April 26, 2005 8:52 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: A simple question on data manipulation
Hi, all
I have a simple question. Suppose I need to generate some observations in
data set A, but for each observation I need to use the values in another
data set B for calculation. What's the best way to do it? e.g. I need to
generate 200 numbers in data set A, but each number is calculated by using a
value in data set B.
I hope I have explained my question. Thanks for your help.
Jason
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|