Help using Base SAS procedures

Problem with MPRINT not producing the resolved macro stuff

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 80
Accepted Solution

Problem with MPRINT not producing the resolved macro stuff

Hi,

I have a large program that has the following OPTIONS statement at the top of the program:

options obs=max mprint mlogic symbolgen macrogen source2 errors=1 validvarname=upcase;

The program starts with the OPTIONS statement then the normal %LETs and FILENAME statements.

Then there is a %MACRO .... %MEND

and then another %MACRO called 'MAIN'

and the %MEND MAIN is on the last page.  And then the execution of the MACRO  'MAIN'. 

There is one other OPTIONS statement with only the following   (  MISSING = '  '  ) close to the last page inside the MAIN macro.

My problem is that I do not receive any of the macro generated code in my LOG file.  I need this information

and I can't figure out why it is not showing up. 

Also this is being run on a LINUX machine. Attached is a small test program I ran that worked fine.

Thanks for any suggestions here.

Nancy

Attachment

Accepted Solutions
Solution
‎10-20-2011 01:05 PM
Trusted Advisor
Posts: 2,113

Problem with MPRINT not producing the resolved macro stuff

Try putting

OPTIONS MPRINT;

right in front of the last macro.  It is a kluge, but will allow you to see the other code.

Doc

View solution in original post


All Replies
Trusted Advisor
Posts: 2,113

Problem with MPRINT not producing the resolved macro stuff

If you say that the test ran fine, then it is a problem in the program itself and not with SAS.  I wonder if the OPTIONS statement might have been commented out inadvertently.  The other thing to look for is a NOMPRINT somewhere.  I know you said that there were no other options, but it might be hidden in some other included or autocall code.

Doc Muhlbaier

Duke

Frequent Contributor
Posts: 80

Problem with MPRINT not producing the resolved macro stuff

So I looked at the program again and find no other OPTIONS statements (besides those two I mentioned).  The program does contain two %INCLUDE and in looking at those, there is no OPTIONS inside these.  This program is in a production directory and I thought maybe there was some type of automatic SAS generated code that suppressed the OPTIONS, but I have other log files where the macro generated code appears.

This is all so puzzling!!

Thanks,  Nancy 

Solution
‎10-20-2011 01:05 PM
Trusted Advisor
Posts: 2,113

Problem with MPRINT not producing the resolved macro stuff

Try putting

OPTIONS MPRINT;

right in front of the last macro.  It is a kluge, but will allow you to see the other code.

Doc

Frequent Contributor
Posts: 80

Re: Problem with MPRINT not producing the resolved macro stuff

Doc,

Do you mean putting the OPTIONS statement before the execution of %MAIN or before the line that starts with

'%MACRO MAIN;'  ?

NANCY

Super User
Super User
Posts: 6,502

Re: Problem with MPRINT not producing the resolved macro stuff

Are you sure that the macro generated any code? 

It is possible that the code is conditional and in your current program the macro has decided to skip all of the parts that generate code.

It is possible the create macros that only execute macro statements and hence will not generate any code. 

Frequent Contributor
Posts: 80

Re: Problem with MPRINT not producing the resolved macro stuff

I changed the first OPTIONS statement back to what it had previously been:

OPTIONS obs=max mprint errors=1 validvarname=upcase;

And I added a new OPTIONS statement, just 'OPTIONS MPRINT' right before the MACRO 'Main' line.

OPTIONS MPRINT;

%macro main;

---------------------------------------------------------------------------------------------------------------------------------------

Now it works!

Why it doesn't recognize the first MPRINT statement I'd like to know!!

Thanks for the suggestion.

Nancy

Super User
Super User
Posts: 6,502

Re: Problem with MPRINT not producing the resolved macro stuff

I would look first to make sure that the OPTION statement is actually running.  It is possible that there is some character in front of it that is converting it into a comment or text string.

Otherwise you would need to check the program statements to see if there are any that have turned off the MPRINT option.

Frequent Contributor
Posts: 80

Re: Problem with MPRINT not producing the resolved macro stuff

Tom,

After you said that, I thought I'd try one more thing.

I copied the beginning of that problem - (which is three pages of comments) and the first couple lines of code that included the OPTIONS statement; into a small program.  I then  opened up a SAS windowing session on the LINUX machine and opened up this new program.  Sure enough the OPTIONS statement was being seen as part of the comments above it. 

Now not that I didn't think of that before, I looked at the comments and saw that it ended with a slash.  But the problem was that the slash at the very top of the program was missing.   This made the next line (OPTIONS statement) become part of the comments because the OPTIONS statement ended with the first semicolon.

Wow - what a headache.  :smileyplain:

Thanks, Nancy

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 146 views
  • 0 likes
  • 3 in conversation