Help using Base SAS procedures

proc print on temporary variables created in macros

Reply
Occasional Contributor
Posts: 11

proc print on temporary variables created in macros

Hi,

I'm new to SAS macros, but have been trying to follow the logics of the program that I have.

Apparently, the program itself is made up of macros, and it creates a lot of temporary variables.

My question is....can I use proc print to generate a report that shows the values of temporary variables? Normally, when I do proc print, and use the "VAR" statement, it only allows me to choose column names that are in the original dataset columns.

Thanks

Super User
Posts: 19,770

Re: proc print on temporary variables created in macros

Posted in reply to SeekYourWay

Have you tried running the program with options mprint or mlogic set instead?

Otherwise you'll need to include some explicit %put &my_mvar at different stages to check what you need.

options mprint mlogic;

/*run your code*/

Occasional Contributor
Posts: 11

Re: proc print on temporary variables created in macros

thank you for the reply, however, I am creating a new post to describe my problem at bit more clearly.

Super User
Posts: 5,497

Re: proc print on temporary variables created in macros

Posted in reply to SeekYourWay

The simple version:

%put _user_;

That's a short-cut that displays all the macro variables you have created, but omits the automatic macro variables that the software creates for you.  You don't get control like you would with a VAR statement in PROC PRINT.

If you want to see the automatic variables, you can use:

%put _automatic_;

Or if you just want all of them, there's:

%put _all_;

There are one or two more possibilities, but you're most likely looking for the first version (_user_).

Good luck.

Occasional Contributor
Posts: 11

Re: proc print on temporary variables created in macros

Posted in reply to Astounding

thank you for the reply, however, I am creating a new post to describe my problem at bit more clearly.

Contributor
Posts: 46

Re: proc print on temporary variables created in macros

Posted in reply to SeekYourWay

Options  symbolgen;

...is helpful too when you want the macro var resolution to go to your log without having to do %put statements.

Occasional Contributor
Posts: 11

Re: proc print on temporary variables created in macros

Posted in reply to JasonDiVirgilio

thank you for the reply, however, I am creating a new post to describe my problem at bit more clearly.

Ask a Question
Discussion stats
  • 6 replies
  • 174 views
  • 6 likes
  • 4 in conversation