LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (December 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 19 Dec 2002 14:58:28 -0600
Reply-To:   Paul Thompson <paul@WUBIOS.WUSTL.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Paul Thompson <paul@WUBIOS.WUSTL.EDU>
Organization:   Washington University in St. Louis
Subject:   Re: return value from macro?
Content-Type:   text/plain; charset=us-ascii; format=flowed

looks like a macro scope problem to me. return is defined as local unless you set it beforehand.

Modify your code by adding %let return=; as noted below, and try again.

N Yiannakoulias wrote: > Hi all, > > Is it possible to have macros return a value? If so, what > am I doing wrong here? > > %MACRO getmean(the_data, v); > PROC SQL; > SELECT sum(&v)/count(&v) INTO: return > FROM &the_data; > QUIT; > &return; > %MEND; > > DATA test; > INPUT v1 v2; > CARDS; > 2 3 > 2 1 > 3 2 > 1 7 > 4 2 > 1 1 > ;

%let return=;

> DATA test2; > SET test; > IF %getmean(test, v1) > 2 THEN DO; > error=%getmean(test, v1); > END; > RUN; > > N >


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