BookmarkSubscribeRSS Feed
deleted_user
Not applicable
can someone tell me why this doesn't print anything? I

%macro test;
%put "hello world";
%mend test;

%test;
3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
Did you look in your SAS log??? That's where %PUT output goes. Your macro worked for me. SAS Log below. Where did you envision having the "hello world" appear????

cynthia

[pre]
1002 %macro test;
1003 %put "hello world";
1004 %mend test;
1005
1006 %test;
"hello world"

[/pre]
deleted_user
Not applicable
I was expecting it to show up exactly where it worked for you. I restarted sas and it worked. I'm not really sure what I did.


Thanks
Hobbes
Calcite | Level 5
My guess is that you probably executed the code once without closing the %MACRO statement with the %MEND statement. So, every next time you executed the code, SAS compiler was still waiting for the closing %MEND keyword appending the code to the opened macro instead of compiling and executing it.

If that happens again you can just execute the mend statement and then try again the full execution of the macro.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 3 replies
  • 1519 views
  • 0 likes
  • 3 in conversation