Date: Thu, 2 Mar 2000 16:41:32 -0500
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: Re: Can a macro return a value ?
Content-Type: text/plain; charset="iso-8859-1"
> From: DOUG CONRAD [mailto:dconrad@CICINFO.COM]
> can a macro return a value similar to a function?
> For example I would like to test the value of the # of obs in
> a data set but would like to reference it such as:
>
> %if %getvalue =1 %then %do:
> etc; etc;
> %end;
Sure, just write your macro with no SAS semicolons.
... This statement may take you a minute to get.
ready?
%macro NOT(N);
%IF &N = 0 %THEN 1;
%ELSE %IF &N = 1 %THEN 0;%MEND;
See, no SAS semicolons, only macro semicolons;
Art Carpenter has a NOBS macro that 'returns' a value, such as you are
looking for.
%macro WHATEVER;
%*all these macro statements;
%*return:; &VALUE.
%MEND;
watch out for them SAS semicolons, they will byte you.
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
---> cheerful provider of UNTESTED SAS code!*! <---
|