DATA Step, Macro, Functions and more

source code for session compiled macro

Reply
Contributor
Posts: 44

source code for session compiled macro

session compiled macro

Macro created and able to invoke and getting the result of  macro But enhance editor closed mistakenly.

Question:  How to get the source code of my macro  (As session not closed, entry in the catalog exists)

Super User
Posts: 17,868

Re: source code for session compiled macro

%Copy

See example in docs

SAS(R) 9.2 Macro Language: Reference

Super User
Posts: 17,868

Re: source code for session compiled macro

Or call macro with mprint source symbolgen options. A bit of work to decipher but better than losing it all.

Moderator
Posts: 238

Re: source code for session compiled macro

It depends on how you compiled/stored the macro. "session compiled macro" is not specific enough for us to tell how you compiled it:

  • Did you just compile the macro (without the /store option) to the WORK.SASMACR catalog? If so, you might be in trouble.
  • Did you store it in a non-WORK catalog, using the MSTORED option, and %macro xyz / store option? If so you might be in luck.


Another thought - why did the Enhanced Editor close suddenly? If SAS crashed, it may not have cleared your WORK folder, so you might at least be able to retrieve the sasmacr.sasb7cat file and stick it somewhere where you could re-invoke the macro and examine the log (as explained in 's reply.


Other suggestions to avoid future repetition:

  • Set your SAS startup options to have an ALTLOG keep a copy of everything you generate. (But remember to purge it periodically..)
  • Keep your macros as *.sas files somewhere whilst developing
  • Anyone with other macro best-practice suggestions?
Ask a Question
Discussion stats
  • 3 replies
  • 193 views
  • 0 likes
  • 3 in conversation