|
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
----------------------------------------------------------------
|