BookmarkSubscribeRSS Feed
ph10
Obsidian | Level 7

I am doing a Macro to deal with datas for an analysis.

And i have two doubts albout dealing with erros, like the data is not avalible, and others

1)     It is possible to create a Macro(functrion)  that is write in another program that is is the same process flow. How to doi it?

2)     if the first option it is true, if we have any better doing this.

 

T

5 REPLIES 5
PaigeMiller
Diamond | Level 26

If you create a program that contains a macro, there are two different ways (maybe more, actually) to use it inside another program. Let's say you have created a macro named %MYMACRO and stored the code for this macro as c:\myfolder\mymacro.sas

 

Method 1: in your other program, use: %include "c:\myfolder\mymacro.sas";

 

Method 2:  in your other program, use: options sasautos=(sasautos "c:\myfolder");

 

In either case, %MYMACRO will now run your macro in the other program

--
Paige Miller
ph10
Obsidian | Level 7

Hello PaigeMiler,

 

       Thanks for the answer, but i had a problem doing the first option. 

       I exported the programa to C:\Users\f8118809\Documents.

       And came this option:

WARNING: Physical file does not exist, /opt/sas94config_anl03/Lev1/SASApp_ANL03/C:\Users\f8118809\Documents\producao.sas.
ERROR: Cannot open %INCLUDE file C:\Users\f8118809\Documents\producao.sas.

 

 

PaigeMiller
Diamond | Level 26

You have given SAS the wrong folder name and/or the wrong file name where the SAS program with the macro is located.

--
Paige Miller
Reeza
Super User

Looks like you're using a server. You need to have the server path for the file, not your local path.

 


@ph10 wrote:

Hello PaigeMiler,

 

       Thanks for the answer, but i had a problem doing the first option. 

       I exported the programa to C:\Users\f8118809\Documents.

       And came this option:

WARNING: Physical file does not exist, /opt/sas94config_anl03/Lev1/SASApp_ANL03/C:\Users\f8118809\Documents\producao.sas.
ERROR: Cannot open %INCLUDE file C:\Users\f8118809\Documents\producao.sas.

 

 


 

ph10
Obsidian | Level 7

Reeza,

 

           Thanks now it is working.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3333 views
  • 2 likes
  • 3 in conversation