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 (October 1998, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 27 Oct 1998 09:01:12 -0500
Reply-To:     "Dorfman, Paul" <pdorfma@UCS.ATT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         "Dorfman, Paul" <pdorfma@UCS.ATT.COM>
Subject:      Re: Problem evaluating a macro variable
Comments: To: "dboylan@UTILICORP.COM" <dboylan@UTILICORP.COM>
Content-Type: text/plain

Dave Boylan, in part, wrote:

>I'm having a bit of trouble with the following macro: > %macro DoFreq(stat=); > Proc freq data = test (where=(state eq &stat )); > table baserate*custchrg*ratecd /list out= work.&stat; > run; > %mend DoFreq; > %DoFreq(stat='CO'); > >Seems the problem lies in the "out= work.&stat" part. It is evaluating to >"Work.'CO'"

Dave,

When you call the macro, you assign 'CO' - together with quotes - to the macrovariable stat. And this is exactly to what &stat resolves. In other words, the phrase work.&stat becomes work.'stat'. Therefore, PROC FREQ receives a syntactically incorrect construct and does not compile. If you turn the option MPRINT on you will see it quite clearly. However, in the text generated by the macro, you want to obtain work.CO. Accordingly, assign this value, without any quotes whatsoever to the parameter stat:

%DoFreq (stat=CO)

and you should be fine provided that the dataset (or view) TEST exists and contains the variables specified on the TABLE statement. As the correct syntax is actually TABLES (as opposed to PROC TABULATE), you may receive a friendly warning that the word has been misspelled, but SAS is smart enough to replace it with the right one.

Good luck!

Kind regards, Paul. ++++++++++++++++++++++++++++++++++++ Paul M. Dorfman CitiCorp UCS Decision Support Jacksonville, FL ++++++++++++++++++++++++++++++++++++


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