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!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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