Date: Tue, 14 Apr 2009 20:44:32 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Syntax for Macro
Content-Type: text/plain; charset=ISO-8859-1
Jason, I don't entirely follow what you want to do. You want your text file
to look like
%SCHL(value_of_school_id, value_of_school_label, value_of_learn_community)
Then you need to do a few things.
First off, single quotes are a must when putting macro calls anywhere.
Otherwise SAS tries to execute your macro, which can get messy.
Second, you should put spaces between the " and the variables. It's not
mandatory, but it's possible for it to cause problems if you end up using a
letter that means something when placed immediately after a quotation mark.
Third, normally you do not place a semicolon after a macro; 99% of the time
it doesn't cause a problem but it can under certain circumstances. Good to
be out of the habit of it in instances where it doesn't harm readability
(the only time I will use it - when the SAS editor gets confused).
Other than that, it should work, I think (barring any specific knowledge of
what your dataset consists of or what your macro is). You might be better
off using CALL EXECUTE, though...
On Tue, Apr 14, 2009 at 8:12 PM, Jason Schoeneberger <
> Hi All,
> I have a few submissions i'm going to be making, but i'll separate them out
> to keep the log clean.
> I've looked through the archives and haven't found a solution to my
> I have the following code that i have used to set 1 variable for a macro,
> but when i add 2 or 3 variables, i get an error:
> DATA _NULL_;
> SET SCHL;
> FILENAME MCALL2 "filelocation\SCHL_Call.sas";
> FILE MCALL2;
> PUT "%SCHL("SCHOOL_ID","SCHOOL_LABEL","LEARN_COMMUNITY");";
> I essentially have a file with one line per school, with values of
> SCHOOL_ID, SCHOOL_LABEL and LEARN_COMMUNITY that i want to call in a macro.
> Can anyone help? I will use this type of functioning all the time.