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

HI,

 

I would like to use SAS Autos in SAS 9.4 desktop version.

 

So i am unable to do it.

Can anyone help me how to use SAS Autos in SAS desktop version. By giving some example.

 

Thank you in advance.

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

That depends on the structure you choose to implement.  If you want a macro in each its own area, then yes (but with comma between them).  Or you could put all your macro text files in one directory (most people do this), and then just supply that directory.  So if for instance you have 3 macros:

freq.sas

print.sas

run.sas

 

And want to indlue those in sasautos, then you can put them all in one directory, for example c:\mymacros, and just include that:

options sasautos=("c:\mymacros");

This will make all three files available to the code.  Or you could put each of those macro files in separate directories, but then your sasautos would need to refer to each folder, hence why most just put all files in one folder.

View solution in original post

12 REPLIES 12
RW9
Diamond | Level 26 RW9
Diamond | Level 26

http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543537.htm

 

"So i am unable to do it." - this does not tell us anything.  You simply set the option to point to the path where macro files are located.

 

Bhavanaa
Calcite | Level 5

Hi,

 

I have read your document but still there i am facing few issues as whatever small macro i am writing it is stored in Work library.

But as we use Libname statement to our own permanent library so for this how to create and store it.

 

and later on there was one option given SASAutos ( filepath);

 

i just want a sample example to understand it much better.

 

Hope you understand my point of view.

 

Thank you in advance.

PaigeMiller
Diamond | Level 26

Show us what you are doing.

--
Paige Miller
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I am sorry, no I have no idea.  To use sasautos, you save macros as text files in a given network location, for instance c:\mymacros.  You then reference this network location in your sasautos:

options sasautos=("C:\mymacros");

You can of course use libnames as well if you prefer.

Bhavanaa
Calcite | Level 5

In case of Single macro.

options sasautos=("C:\mymacros");  * This worked;

 

And if i want to use more macros then i should use it in this way please correct me if i am wrong.

 

options sasautos=("C:\mymacros\Test_print"
"C:\mymacros\freq"
"C:\mymacros\quant");

 Thanks a lot for the help.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

That depends on the structure you choose to implement.  If you want a macro in each its own area, then yes (but with comma between them).  Or you could put all your macro text files in one directory (most people do this), and then just supply that directory.  So if for instance you have 3 macros:

freq.sas

print.sas

run.sas

 

And want to indlue those in sasautos, then you can put them all in one directory, for example c:\mymacros, and just include that:

options sasautos=("c:\mymacros");

This will make all three files available to the code.  Or you could put each of those macro files in separate directories, but then your sasautos would need to refer to each folder, hence why most just put all files in one folder.

Bhavanaa
Calcite | Level 5

Thanks a lot. 

 

This worked as i have used multiple macros.

 

 

ballardw
Super User

@Bhavanaa wrote:

HI,

 

I would like to use SAS Autos in SAS 9.4 desktop version.

 

So i am unable to do it.

Can anyone help me how to use SAS Autos in SAS desktop version. By giving some example.

 

Thank you in advance.


What I have currently implemented for my "desktop version", SAS Display Manager or "Base SAS" is

1) modified the sasv9.cfg file, which in my install resides in : C:\Program Files\SASHome\SASFoundation\9.4\nls\en

to use an AUTOEXEC.SAS file by adding a line similar to:

-AUTOEXEC "C:\path\autoexec.sas"

2) create your autoexec.sas with code you want and place it in the location supplied in the sasv9.cfg file.

The autoexec.sas contains code that is executed on start up.

3) include a line similar to:

options insert=(SASAUTOS = ("C:\path"));

Using INSERT adds your location to the beginning of the list of locations that SAS uses for its internal macro search path. This means if you have a macro the same name as one of the SAS supplied macros yours is found first. You could use APPEND instead to place at the end of the macro search path.

4) In the folder referenced in the options statement above each of your macros must have a file matching the name of the macro the only code should be the actual macro definition. One macroname.sas file for each macro.

 

I go through the bit of using an autoexec file as it provides a single point for setting up a moderate number of options that I want every time SAS starts. Otherwise you just need the proper OPTIONS statement executed before the first macro call. But be careful of not using the insert or append option as you may disable some of the SAS supplied macros.

 

If you poke around in the sasv9.cfg you will find the base definition of the SASAUTOS paths and may be surprised at how many locations are already involved.

Bhavanaa
Calcite | Level 5
Hi,

It's not that easy to understand. And sasv9.cfg file. exe file i dont know from where to install.

Thanks a lot for your reply.

Regards,
Bhavana
Kurt_Bremser
Super User

Depending on the way you work with SAS (locally on a PC with Display Manager, Enterprise Guide with the "Local" server, Enterprise Guide or SAS Studio with a remote workspace server), you have configuration and startup files that control SAS behaviour at startup. If you want to automate things so that they are automatically done when a SAS session starts, you need to get a grasp on your environment and the files involved.

 

If it's OK for you to set the SASAUTOS option "manually" every time you run your code, then you don't need to worry about all that.

ballardw
Super User

@Bhavanaa wrote:
Hi,

It's not that easy to understand. And sasv9.cfg file. exe file i dont know from where to install.

Thanks a lot for your reply.

Regards,
Bhavana

Everything I mentioned are TEXT files that you edit in place or in the case of the autoexec.sas create as you would any other program.

No EXE was mentioned, nothing to install.

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
  • 12 replies
  • 2720 views
  • 2 likes
  • 5 in conversation