DATA Step, Macro, Functions and more

hello world problem

Reply
N/A
Posts: 0

hello world problem

can someone tell me why this doesn't print anything? I

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

%test;
SAS Super FREQ
Posts: 8,864

Re: hello world problem

Posted in reply to deleted_user
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]
N/A
Posts: 0

Re: hello world problem

Posted in reply to Cynthia_sas
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
Occasional Contributor
Posts: 16

Re: hello world problem

Posted in reply to deleted_user
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.
Ask a Question
Discussion stats
  • 3 replies
  • 177 views
  • 0 likes
  • 3 in conversation