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 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 3 Mar 2000 08:49:05 -0500
Reply-To:   DOUG CONRAD <dconrad@CICINFO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   DOUG CONRAD <dconrad@CICINFO.COM>
Subject:   Re: Can a macro return a value ?-thanks
Content-Type:   text/plain; charset="iso-8859-1"

Though I can't see my own email message sent to sas-L (and never have-WHY???)Thanks to all for your input. I'll sit back and evaluate what I received for feedback. Great responses.

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


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