BookmarkSubscribeRSS Feed
fd2010
Calcite | Level 5
I am using SAS9.2 on windows, when I submit the following statements:
*****************************************************;
%let mymacro=%str(C:\mymacro.sas);
data _null_;
file mymacro;
put "%macro mymacro(crt=);" ;
put "More code";

put "%mend mymacro();" ;
run;
****************;

I got this note in the log and the data step doesn't finish:
***Log ***;
101 data _null_;
102 file mymacro;
103 put "%macro mymacro(crt=);"
---------
49
103! ;
NOTE 49-169: The meaning of an identifier after a quoted string may change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.

104 put "More code";
105
106 put "%mend mymacro();" ;
107 run;
**********end of log*********;

If I submit the following code:
***************************;
data _null_;
file mymacro;
put "%%macro mymacro(crt=);" ;
put "More code";

put "%%mend mymacro();" ;
run;
***********;

I got the following output, noticing the double %. How do I make SAS to output only one %?

*******************;
%%macro mymacro(crt=);
More code
%%mend mymacro();
*****************************;
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest you share the first 100 lines of your SAS log as well.....

Scott Barry
SBBWorks, Inc.
fd2010
Calcite | Level 5
That is all there is. I also got the 'Data Step running' in the Editor window bar, i.e., it hangs there until I quit SAS. Then it is saying %mend missing in the log before exiting. Essentially, I wonder how I can write a macro with put statement?

*************************************************************;
1 %let mymacro=%str(C:\mymacro.sas);
2 data _null_;
3 file mymacro;
4 put "%macro mymacro(crt=);"
--------
49
4 ! ;
NOTE 49-169: The meaning of an identifier after a quoted string may change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.

5 put "More code";
6
7 put "%mend mymacro();" ;
8 run;
fd2010
Calcite | Level 5
It dawned on me that if I used single quote, I don't get the note in the log and the output is fine with one %!

Thanks to everyone who tried to help!

*****************************************************;
%let mymacro=%str(C:\mymacro.sas);
data _null_;
file mymacro;
put '%macro mymacro(crt=);' ;
put "More code";

put '%mend mymacro();' ;
run;
****************;
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
  • 1913 views
  • 0 likes
  • 2 in conversation