SAS MACRO CATALOG: How to retrieve the source code of a compiled macro?

Reply
Contributor
Posts: 28

SAS MACRO CATALOG: How to retrieve the source code of a compiled macro?

Hi everybody,

As far as I know, one can retrieve the source code of the complied macro using the following code, but only,

if the macro was stored with the option /STORE SOURCE.

%COPY   <macro name>/SOURCE ;

Is there any chance to get the source code when the macro was compiled and only /STORE option was used?

I received a macro catalog with older entries (some macros from 1999) and not all corresponding macro programs exist.

Thank you in advance,

Natalie

Trusted Advisor
Posts: 1,301

Re: SAS MACRO CATALOG: How to retrieve the source code of a compiled macro?

As long as the macro was not compiled with the secure option then you can retrieve the source code by reading the catalog entries:

libname mcat "/path/to/catlog/dir";

filename mcat catalog "mcat.sasmacr.nonsecure.macro"; *[libname].sasmacr.[macname].macro ;

data _null_;

infile mcat;

input;

list;

run;

EDIT:  This is documented in the %MACRO Statement of the SAS Macro Language Reference Manual

SAS(R) 9.2 Macro Language: Reference

Contributor
Posts: 28

Re: SAS MACRO CATALOG: How to retrieve the source code of a compiled macro?

Hi Matthew,

thanks, the sas code worked fine, but the content in LOG was unfortenately not readable Smiley Sad

(I tired it on one of my own macros, which were defentely not stores in secure mode)

This is what I get in LOG (very confusing):

 

RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8

1 CHAR ......CHECK_VARIABLES...................PL..9.2 ........................ ...

ZONE 00000044444554544444500000000000000000005400323222220000000000000000000010002000

NUMR 1000F03853BF612912C5300000000000000000000C009E2000000000400000000000100000000000

81 ....+...€...°...>................... 116

ZONE 000020008000B00030000000000000000000

NUMR B100B0000E000000E0000000000000000000

2 CHAR ........_CHECKDATASET........................... 48

ZONE 000000005444444454545000000000000000000000000000

NUMR 200000D0F3853B4141354000000000000000000000000000

Natalie

Respected Advisor
Posts: 3,799

Re: SAS MACRO CATALOG: How to retrieve the source code of a compiled macro?

You have to dig.

You might also look up the LIST command to understand the output created.

Super User
Posts: 10,044

Re: SAS MACRO CATALOG: How to retrieve the source code of a compiled macro?

Or did you try :    options mprint mlogic symbolgen ;

Ask a Question
Discussion stats
  • 4 replies
  • 1630 views
  • 0 likes
  • 4 in conversation