BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GeorgeSAS
Lapis Lazuli | Level 10

Hello all,

 

 

How to check what is the AUTOEXEC defination for the current SAS?

 

Also how to check initial of the SAS session?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
Super User

You might start with:

%put %sysfunc(getoption(autoexec));

If that returns autoexec.sas, you might still need to look around to find which autoexec.sas file was read (there are rules for where SAS searches).

 

 

What do you mean by "check initial of the SAS session"?  Do you mean version?

%put &sysvlong;
The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

View solution in original post

7 REPLIES 7
ChrisBrooks
Ammonite | Level 13

This will give you the location of the autoexec file for the current session

 

proc options option=autoexec;
run;

You can then read this in any text editor.

 

As for the second part of your question - the initial what?

Quentin
Super User

You might start with:

%put %sysfunc(getoption(autoexec));

If that returns autoexec.sas, you might still need to look around to find which autoexec.sas file was read (there are rules for where SAS searches).

 

 

What do you mean by "check initial of the SAS session"?  Do you mean version?

%put &sysvlong;
The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
BrunoMueller
SAS Super FREQ

Have a look at the GETOPTION function, it can return different information like:

Return Value Options

DEFAULTVALUE

returns the default option value.

Restriction DEFAULTVALUE is valid only for SAS system options. SAS issues a warning message when the DEFAULTVALUE option is specified and option-name is a graphics option.

HOWSCOPE

returns a character string that specifies the scope of an option.

Restriction HOWSCOPE is valid only for SAS system options. SAS issues a warning message when the HOWSCOPE option is specified and option-name is a graphics option.

HOWSET

returns a character string that specifies how an option value was set.

Restriction HOWSET is valid only for SAS system options. SAS issues a warning message when the HOWSET option is specified and option-name is a graphics option.

STARTUPVALUE

returns the system option value that was used to start SAS either on the command line or in a configuration file.

Restriction STARTUPVALUE is valid only for SAS system options. SAS issues a warning message when the STARTUPVALUE option is specified and option-name is a graphics option.

 

Ron_MacroMaven
Lapis Lazuli | Level 10

the option echoauto shows the statements in the autoexec.sas program

otherwise all you get is this message:

NOTE: AUTOEXEC processing beginning; file is C:\temp\sas-c-temp\autoexec.sas.

 

Here is my setup for Windows DOS batch programs.

 

 

*name: autoexec.sas;
title1 'My Project'; filename project '.';*here; libname library '..\sas7b'; options linesize=max pagesize=max;

 

Here is a paper with the list of global statements to hide in the autoexec:

 

An Autoexec Companion, Allocating Location Names during Startup

 

 

next: a program which does next to nothing;

*name: autoexec-test.sas;
filename project list;*unlike libname which does list when allocated; %put _global_;

 

 

the option echoauto works like source2 on an %include:

 

%include 'autoexec.sas'/source2;

 

rem name: autoexec-test.bat
sas autoexec-test -echoauto

 

hth

 

Ron Fehd  formerly (MVS or z/OS), now Batch_processing_under_Windows maven

 

GeorgeSAS
Lapis Lazuli | Level 10

Hello Ron,

 

May I ask you submit SAS batch job in PC or windows server?

 

Thanks!

Ron_MacroMaven
Lapis Lazuli | Level 10
my programs and data were on a server

I had PC-SAS on each of the computers that I used to access those programs.

I neglected to show my file sas.cmd

rem: sas.cmd
call "C:\...\SASFoundation\9.4\sas.exe" %*

where %* is the DOS command for "pass all command-line options"

you may need sasv9.cfg

hth
Ron

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
  • 7 replies
  • 2895 views
  • 5 likes
  • 6 in conversation