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

I have some ABC macro.

 

I have called ABC macro with mprint option. I can see sas code of the complied macro with notes and etc.

 

I want clean code of that complied macro where I can edit code in between any step and run that code for my self.

 

 

please help.

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

If a macro is compiled with the source option, you can copy the code to a file:

option mstored sasmstore=sasuser;
%macro test/store source;
%put this is my macro;
%mend;

%copy test/source outfile='$HOME/sascommunity/test.sas';

or just to the log:

%copy test/source;

With the second method, you'll already have clean code for copy/pasting in the log:

28         %macro test/store source;
29         %put this is my macro;
30         %mend;
31         
32         %copy test/source;
%macro test/store source;
%put this is my macro;
%mend;

You find this in the documentation of the %COPY statement.

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

"I can see sas code of the complied macro with notes and etc." - you can see this in the log yes?

 

"I want clean code of that complied macro " - other than taking the log output and cleaning it up yourself, the best idea is to get the source text.  It is always best to get the source text (in fact its always best to keep macros as plain text files - this would not only make this question easier, but there are a number of issues with proprietary binary files - if you ever try to go 32bit-64bit or vice versa you will find out).

 

"where I can edit code in between any step and run that code for my self." - this does not make any sense, code is created before run time, if you need to have generic code, then you need macro coding or call execute.  However as you have not provided any information I cannot provide any further help.

Kurt_Bremser
Super User

If a macro is compiled with the source option, you can copy the code to a file:

option mstored sasmstore=sasuser;
%macro test/store source;
%put this is my macro;
%mend;

%copy test/source outfile='$HOME/sascommunity/test.sas';

or just to the log:

%copy test/source;

With the second method, you'll already have clean code for copy/pasting in the log:

28         %macro test/store source;
29         %put this is my macro;
30         %mend;
31         
32         %copy test/source;
%macro test/store source;
%put this is my macro;
%mend;

You find this in the documentation of the %COPY statement.

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