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 (March 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 14 Mar 2000 19:45:54 +0000
Reply-To:   John Whittington <John.W@MEDISCIENCE.CO.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   John Whittington <John.W@MEDISCIENCE.CO.UK>
Subject:   Re: Reading two SAS datasets in one DATA step
Comments:   To: Michael.Thomas@EQUIFAX.COM
In-Reply-To:   <200003141919.TAA11667@vicar.netnames.net>
Content-Type:   text/plain; charset="us-ascii"

At 14:17 14/03/00 -0500, Michael Thomas wrote:

>I am missing something here but what I am trying to do (unsuccessfully) is to >read the dataset nostrt for every observation in armstr. What is happening is >that (I think) SAS is only reading the first observation from ARMSTR before >stopping the DATA step. > >I think it is a simple mistake I am making but I just can't quite see it..... >maybe one of you guru-types can point me in the right direction > >data nstrtdt(keep=Merch_No Change1-Change4 Strt_Dt); > set armstr end=eof1; /* 190,000 obs */ > do until(eof1); > set nostrt end=eof2; /* 600 obs */ > if aMerchNo=Merch_No or > aMerchNo=Change1 or > aMerchNo=Change2 or > aMerchNo=Change3 or > aMerchNo=Change4 then do; > Strt_Dt = astrtdt; > output; > end; > end; >run;

The behaviour you describe is logical. Having read the first observation from AMSTR, one then enters the DO loop which, if nothing else happened, would go on for ever, since the UNTIL condition would not ever be satisfied. However, the loop - and, indeed, the entire DATA step stop when the second SET gets to the end of (its first read of) NOSTRT.

There are various ways around this problem of the DATA step being terminated by reaching the end of NOSTRT for the first time. One of the simplest would probably be to replace:

> do until(eof1); > set nostrt end=eof2; /* 600 obs */

with:

do p = 1 to nobs ; set nostrt point = p nobs=nobs ; /* 600 obs */

Any help?

Kindest Regards,

John

---------------------------------------------------------------- Dr John Whittington, Voice: +44 (0) 1296 730225 Mediscience Services Fax: +44 (0) 1296 738893 Twyford Manor, Twyford, E-mail: John.W@mediscience.co.uk Buckingham MK18 4EL, UK mediscience@compuserve.com ----------------------------------------------------------------


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