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 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 20 Aug 2008 15:51:48 -0400
Reply-To:     Bucher Scott <SBucher@SCHOOLS.NYC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Bucher Scott <SBucher@SCHOOLS.NYC.GOV>
Subject:      Re: macro variable generated by Proc SQL
Comments: To: adjmost@COMCAST.NET
Content-Type: text/plain; charset="us-ascii"

[...seems to have bounced back, please excuse if this is a re-post...] Hi,

In short, do one of the following: *first declare the variables outside of the macro *use the %global statement to create the variables inside the macro *create the macro variables with CALL SYMPUTX instead of PROC SQL. They do much of the same thing in terms of macro variable creation, but one the arguments of CALL SYMPUTX also allows you to declare the scope of the variables created.

My explanation is a poor one, but I'm sure if you search SAS-L of lexjan for 'macro variable scope' you will find many much more comprehensive treatments on the subject. I strongly recommend this, as having a firm understanding of how scopes of variables work will save you many headaches in the future if you continue to use macros.

Regards, Scott

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of adjmost@COMCAST.NET Sent: Wednesday, August 20, 2008 3:14 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: macro variable generated by Proc SQL

On Aug 20, 11:43 am, SBuc...@SCHOOLS.NYC.GOV (Bucher Scott) wrote: > Are you running %PUT _USER_; inside the macro? Unless otherwise > declared, the scope of the variables will be local, i.e. will not exist > once the macro they are in stops running. > > -Scott

Scott, I followed your suggestion and put the %PUT _USER_; inside the macro. Now I can see the values. However I need to use those values outside the macro. How do I declare them as global macro variables?



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