DATA Step, Macro, Functions and more

How do I use macros to save and list all macros in a session

Reply
Occasional Contributor
Posts: 6

How do I use macros to save and list all macros in a session

I would like to save all the macros permanently defined as part of the complete exercise and list all the macros. I have 6 macros which I want to save and retrieve in this session:

%macro one(a,b,c)
%macro gchart(dseti,Weight,Gender)
%macro plot(dsetin,height,weight)
%macro one(a,b,c,strtpt,endpt)
%macro test
%macro name(dsetin,year,revenue)
%macro import_myfile(i=)

I have the code below and the error message follows it.

options mstored sasmstore=macross; 
libname mjstore "C:\Users\komal\Desktop\Advanced SAS"; 
 proc catalog cat=mjstore.macross;
      contents;
      title "Default Storage of SAS Macros";
     quit

Error: Catalog "MJSTORE.MACROSS" not found

Please let me know your advice on how to solve it. Thank you for your time.

Super User
Posts: 10,574

Re: How do I use macros to save and list all macros in a session

This:

Error: Catalog "MJSTORE.MACROSS" not found

tells you that there is no file

macross.sas7bcat

in directory

C:\Users\komal\Desktop\Advanced SAS

Maybe you wanted to use

MJSTORE.MACROS

?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Super User
Posts: 9,840

Re: How do I use macros to save and list all macros in a session

Avoid using compiled catalogs, save macro's as text files and include them or put them as part of the auto call.  Compiled libraries are bad, compatability between systems/bits is poor, code is hidden making updating or general use so much harder.  

Super User
Posts: 24,010

Re: How do I use macros to save and list all macros in a session

If your macros are not declared with the SOURCE option it's hard to get the code back out. Did you declare them with the SOURCE option? 

 

 

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