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 (April 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 26 Apr 2005 10:21:01 -0600
Reply-To:   Alan Churchill <SASL001@SAVIAN.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Alan Churchill <SASL001@SAVIAN.NET>
Subject:   Re: A simple question on data manipulation
Comments:   To: Jason Shen <jason80115@YAHOO.COM>
In-Reply-To:   <20050426155133.88550.qmail@web61207.mail.yahoo.com>
Content-Type:   text/plain; charset="us-ascii"

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


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