BookmarkSubscribeRSS Feed
ph10
Fluorite | Level 6

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
Fluorite | Level 6

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
Fluorite | Level 6

Reeza,

 

           Thanks now it is working.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 2421 views
  • 2 likes
  • 3 in conversation