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

Hi all,

 

I've been using a macro library so that I can use macros without compiling them first. The problem is that when I change the macro and save it, then refresh my filename for the macro lib, this is not enough to update and use the new macro?

 

Anyone have any ideas why it is still using and compiling the old macro before it was saved?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

@89974114 wrote:

Hi all,

 

I've been using a macro library so that I can use macros without compiling them first. The problem is that when I change the macro and save it, then refresh my filename for the macro lib, this is not enough to update and use the new macro?

 

Anyone have any ideas why it is still using and compiling the old macro before it was saved?


When you change a macro and save it, SAS doesn't use the saved copy if you have previously used the macro in that session. It uses the version of the macro before the changes that is still in SAS's memory.

 

To make sure the changed macro is used, you need to submit the macro via the SAS Editor.

 

http://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=mcrolref&docsetTarget=n1o5fkxq...

 

Capture.PNG

--
Paige Miller

View solution in original post

12 REPLIES 12
ballardw
Super User

If you are using a compiled macro library then you must re-compile the macro to use the new version. Saving the source code is not enough.

 

System options such as mautosource, mstored, mcompile, mrecall and mreplace also may come into play as well.

 

 

 

PaigeMiller
Diamond | Level 26

@89974114 wrote:

Hi all,

 

I've been using a macro library so that I can use macros without compiling them first. The problem is that when I change the macro and save it, then refresh my filename for the macro lib, this is not enough to update and use the new macro?

 

Anyone have any ideas why it is still using and compiling the old macro before it was saved?


When you change a macro and save it, SAS doesn't use the saved copy if you have previously used the macro in that session. It uses the version of the macro before the changes that is still in SAS's memory.

 

To make sure the changed macro is used, you need to submit the macro via the SAS Editor.

 

http://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=mcrolref&docsetTarget=n1o5fkxq...

 

Capture.PNG

--
Paige Miller
89974114
Quartz | Level 8

Great answer, thanks. I'll start looking for a function that clears the macro library where the recently compiled functions are

PaigeMiller
Diamond | Level 26

@89974114 wrote:

Great answer, thanks. I'll start looking for a function that clears the macro library where the recently compiled functions are


When you modify a macro, just submit the code. Nothing more complicated than that is needed.

--
Paige Miller
89974114
Quartz | Level 8

It's not an ideal solution as it's a package of many macros which is going to be handed over to someone else to use

PaigeMiller
Diamond | Level 26

@89974114 wrote:

It's not an ideal solution as it's a package of many macros which is going to be handed over to someone else to use


I don't see how this relates to the rest of the thread.

--
Paige Miller
89974114
Quartz | Level 8

If I understand, I read your comment such that I need to run the code again before proceeding with a run of the package, or are you saying just run the macro again with the file kept elsewhere?

PaigeMiller
Diamond | Level 26

@89974114 wrote:

If I understand, I read your comment such that I need to run the code again before proceeding with a run of the package, or are you saying just run the macro again with the file kept elsewhere?

 


It's not an ideal solution as it's a package of many macros which is going to be handed over to someone else to use

Nowhere in the previous discussion has a "package" been mentioned. Please explain.

--
Paige Miller
89974114
Quartz | Level 8

The package would just be a usb with the macro file on it and a cover programme to run with macros manifested inside

PaigeMiller
Diamond | Level 26

So I still don't understand what this has to do with the original question. In the original question, you (not someone else) saved a macro and then SAS continued to use the old macro. Please explain the linkage between the original question where you change a macro; and giving the software to someone else.

--
Paige Miller
ballardw
Super User

@89974114 wrote:

The package would just be a usb with the macro file on it and a cover programme to run with macros manifested inside


One would suggest that if you are still testing and modifying the macros then the macros are not ready to share.

 

Also having compiled macros without the source code is one of the ways that organizations can hurt themselves. The binary compiled macros may not transfer across operating systems or OS with different "bitness". Macros compiled in a 32-bit system will not work for one running 64-bit version of the same operating system, or vice versa. If you search this forum you can find instances of organizations that had "lost" the source code of the macros, updated their systems and had the macro library stop working and throw errors due to this. And then trying to regenerate the source fails.

 

If you insist on the compiled macros the consider using the option SOURCE option as well as STORE. That way if you have one of the above issues later it is possible to recover the macro definition by finding an older version of SAS and/or OS but having the code in a source catalog along with the macro. Keep the source and macros in the same library.

89974114
Quartz | Level 8

I was just under the impression that paige said I'd have to compile the macros by hand everytime I make a change which wouldn't be ideal once I leave this package of macros to the next person, who may or may not want to change them in the future.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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