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 (April 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: Jason Schoeneberger <jschoeneberger@carolina.rr.com>
In-Reply-To:  <200904150112.n3EKnXQO019825@malibu.cc.uga.edu>
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) Correct?

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...

call execute(cats('%schl(',school_id,',',school_label,',',learn_community,')'));

-Joe

On Tue, Apr 14, 2009 at 8:12 PM, Jason Schoeneberger < jschoeneberger@carolina.rr.com> wrote:

> 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 > problem. > 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");"; > RUN; > > 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. > > Thanks, > Jason >


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