Date: Sun, 12 Oct 2003 07:37:53 +0100
Reply-To: Roland <roland@RASHLEIGH-BERRY.FSNET.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roland <roland@RASHLEIGH-BERRY.FSNET.CO.UK>
Organization: Universe Monitors
Subject: Re: Error message when a counting macro variable is zero
Set the macro variable to zero before the stage where you count the
observations.
BTW, this is not an efficient solution. You can extract this information
about the number of rows in a data set without reading them all as you are
doing.
"Rune Runnestoe" <rune@fastlane.no> wrote in message
news:24410121.0310111348.7437116e@posting.google.com...
> Here is a real problem I have struggled with for some time now.
> First, I make a macro variable telling me how many records there are
> in a data set. In this case, there is zero, and that's where I get the
> error message in the log. I don't get the error message in the log
> when there are 1 or more records in the data set.
>
> data _null_;
> set &bibl..datoformat_ugyldige_sak end=siste_record;
> if siste_record then
> call symput('ant_datoformat_ugyldige_sak', trim(left(_n_)));
> run;
>
> Then I use the number of rows in the data set to evaluate whether a
> proc print is going to run or not:
>
> %macro print_datoformat;
> %if &ant_datoformat_ugyldige_sak > 0 %then
> %do;
> proc print data=&bibl..datoformat_ugyldige_sak ;
> title1 "Records i SAK.DAT med ugyldige format på datofelt";
> run;
> %end;
> %mend;
> %print_datoformat;
>
>
>
> 35977 %print_datoformat;
> MLOGIC(PRINT_DATOFORMAT): Beginning execution.
> WARNING: Apparent symbolic reference ANT_DATOFORMAT_UGYLDIGE_SAK not
> resolved.
> ERROR: A character operand was found in the %EVAL function or %IF
> condition where a numeric
> operand is required. The condition was:
> &ant_datoformat_ugyldige_sak > 0
> ERROR: The macro PRINT_DATOFORMAT will stop executing.
> MLOGIC(PRINT_DATOFORMAT): Ending execution.
>
> The question is how I can avoid the error message in the log ?
>
>
> Regards
>
> Rune Runnestoe
|