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 (August 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 27 Aug 2001 13:50:32 -0400
Reply-To:   kviel <kviel@GMCF.ORG>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   kviel <kviel@GMCF.ORG>
Subject:   Re: Macros and global variables
Content-Type:   text/plain; charset="iso-8859-1"

Eugenio,

I want to point out that a %LET statement can accomplish the assignment of a global macro variable. I have also provided a small macro to do the same. Note, the MDY() function takes numberic variables and arguments. SAS will automatically do this. Second, to pass a data step variable value to a macro variable you can use call symput:

6 %macro name (var=,month=,day=,year=); 7 %global &var; 8 data _null_; 9 call symput ("&var", put(%sysfunc(mdy(&month,&day,&year)),5.)); 10 run; 11 %mend name; 12 13 %name (var=y,month=6,day=30,year=2001);

NOTE: DATA statement used: real time 0.01 seconds cpu time 0.01 seconds

14 15 %put &y; 15156 16 17 %let yy=%sysfunc(mdy(6,30,2001)); 18 19 %put &yy; 15156

I hope this helps.

Kevin

Kevin Viel Georgia Medical Care Foundation 57 Executive Park South, NE Suite 200 Atlanta, GA 30329-2224


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