BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AJ_Brien
Quartz | Level 8

Hello,

 

I'm trying to figure out a way to display the contents of a macro function into the sas output window instead of the log window. 

 

this is just a sample, just trying to understand a concept here. I know we can use put and %put for variables and macro variables, but what can we do to display the contents of a macro function stored in a remote unix location in the output window instead of the log file. Thank you for your guidance 🙂

 

Below is the sample code:

 

options mautosource sasautos = ('unix path location for macro')  
                               nocenter source2 mlogic symbolgen mprint;

%include 'unix path location for macro/checkk.sas';

data _null_;
title 'macro details:';
put z = %checkk;
title;
run;


Details in macro checkk:

File name is checkk.sas
%macro checkk;
a=1 or b=3
%mend;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

It may help if you show something that actually should create some output and what you would expect to appear in the output destination.

 

Since your "example" output for the data step is basically a bunch of uninitialized variables it doesn't make much sense

 

And is the macro itself supposed to provide the output???

I don't understand your comment about the P statement of Proc Odstext other than in that context:

 

If I run:

%macro checkk;
a=1 or b=3
%mend;

proc odstext;
p "%checkk";
run;




The results window shows

a=1 or b=3

 

 

View solution in original post

5 REPLIES 5
Reeza
Super User
Maybe PROC ODSTEXT, but you may need a proc to trigger the output. At least ODS TEXT did.

A workaround is to push the data to a data set and PROC PRINT/REPORT on the data set to the results viewer.
AJ_Brien
Quartz | Level 8
thank you for your reply.

the macro will most likely contain a bunch of conditions, such as if %checkk then delete; will be the kind of condition used. So I'm not sure if i can push that into a dataset. I tried working around odstext, but looks like it requires 'P' to be added before each line in the macro. That will be an issue if I end up using this with multiple macros in the future.

The main purpose of doing this exercise is to be able to see what the macro in the remote location consists of without going out of the way and opening that file through winscp or another software.
Reeza
Super User
Sorry, I don't understand what you're trying to do then. Good Luck!
ballardw
Super User

It may help if you show something that actually should create some output and what you would expect to appear in the output destination.

 

Since your "example" output for the data step is basically a bunch of uninitialized variables it doesn't make much sense

 

And is the macro itself supposed to provide the output???

I don't understand your comment about the P statement of Proc Odstext other than in that context:

 

If I run:

%macro checkk;
a=1 or b=3
%mend;

proc odstext;
p "%checkk";
run;




The results window shows

a=1 or b=3

 

 

AJ_Brien
Quartz | Level 8
ah I see what you did here. This is what I was looking to see how to use. Thank you!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 5024 views
  • 2 likes
  • 3 in conversation