BookmarkSubscribeRSS Feed
BenoîtOry
Fluorite | Level 6

Hello,

 

We are using SAS 9.4 with SAS Studio 3.81, we are used to update some SAS options default values like these:

options nodate validarname=upcase;

We observed that these values do not follow from one execution of a program to another.

 

How to reproduce this behaviour?

1. Create a first program, add "options validvarname=upcase; proc options;run;" and run it: validvarname is well passed to upcase

2. Then create a second program, add "proc options;run"; and run it: validvarname has been reinitialized by his default value (any)!

 

Is this behavior linked to SAS Studio interface?

Is it related to a setting in our environment?

 

Thank you!

22 REPLIES 22
Shmuel
Garnet | Level 18

1. running "options .." doen't need to run "proc options" in order to activate it.

2. you can assign more then one option in "options" statement, as in 

options nodate  validvarname=upcase ;

3. You can add above line into the autoexec.sas  program, which is executed within entering sas studio.    

 

 

 

andreas_lds
Jade | Level 19

@BenoîtOry wrote:

I understand what I see by reading that: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/p0yzcadln7ame4n1hpr06f8a2nwl.htm


Would be interesting to know where those options are set and how to modify them.

Shmuel
Garnet | Level 18

The article you sent deals with options statement submitted by you, that is when you are alraedy in sas studio,

If you want that some options will be automaticaly set for all sessions  in future, you can add the options statement in the autoexec.sas program. 

If it is a private installation you can do it yourself, otherwise you can ask the sas administartor to it for you. 

andreas_lds
Jade | Level 19

@Shmuel wrote:

...

If you want that some options will be automaticaly set for all sessions  in future, you can add the options statement in the autoexec.sas program. 

...


This doesn't work with SAS Studio, because the mentioned options are set automatically each time code is executed. So the only "solution" i can see, is using %include as first statement in each program loading/executing a program containing all options that one wants not be change by stupid automatism.

Shmuel
Garnet | Level 18

As much as I understand the hierarchy of options in SAS, it is in that order:

1. Options assigned at SAS installation(configuration file)

2. Options assigned at SAS initiation (autoexec file)

3. Options changed by submitted code.

 

I believe that SAS administrator of SAS studio of the site, may change those options. My experience is with he Students vaersion (not used any more) which is a variance of SAS studio.

 

I retired 6 years ago and may be i'm not familiar enough with the todays platforms.

Tom
Super User Tom
Super User

@Shmuel wrote:

As much as I understand the hierarchy of options in SAS, it is in that order:

1. Options assigned at SAS installation(configuration file)

2. Options assigned at SAS initiation (autoexec file)

3. Options changed by submitted code.

 

I believe that SAS administrator of SAS studio of the site, may change those options. My experience is with he Students vaersion (not used any more) which is a variance of SAS studio.

 

I retired 6 years ago and may be i'm not familiar enough with the todays platforms.


Not quite complete.

1) The options set by the configuration file used.  Which configuration file to use is dependent upon how SAS is started.  You generally setup the configuration files when you install SAS, but you can make and use new ones at any time.

2) Options set on the command line when SAS is started .

3) Any options statements statements run by startup commands.  In addition to the autoexec.sas file there is also -initcmd and initstmt options that could cause options statements to be run.

4) Any options statements executed.  Or possibly using PROC OPTIONS to load saved options from a dataset.

 

In SAS/Studio (and I assume other front-end tools like Enterprise Guide) you also have to deal with the SAS code that that the front end submits before (and after) your code that it sends to SAS.

 

With SAS/Studio you can change preferences so that the generated code is shown in the SAS log.

Tom_0-1670249234118.png

What code is generated depends on other preferences, but I think the main things that change are related to output destinations.  In this example from SAS On Demand for Academics only code lines 68 and 69 were what was in the code I submitted.

 1          OPTIONS NOSYNTAXCHECK;
 2          TITLE;
 3          FOOTNOTE;
 4          OPTIONS LOCALE=en_US DFLANG=LOCALE;
 5          DATA _NULL_;
 6          RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 7          OPTIONS VALIDVARNAME=ANY;
 8          OPTIONS VALIDMEMNAME=EXTEND;
 9          FILENAME _HTMLOUT TEMP;
 10         FILENAME _GSFNAME TEMP;
 11         FILENAME _DATAOUT TEMP;
 12         %LET SYSCC=0;
 13         %LET _CLIENTAPP='SAS Studio';
 14         %LET _CLIENTAPPABREV=Studio;
 15         %LET _CLIENTAPPVERSION=3.8;
 16         %LET _CLIENTVERSION=3.8;
 17         %LET _CLIENTMODE=wip;
 18         %LET _SASSERVERNAME=%BQUOTE(SASApp);
 19         %LET _SASHOSTNAME=%BQUOTE(odaws04-usw2);
 20         %LET _SASPROGRAMFILEHOST=%BQUOTE(odaws04-usw2);
 21         %LET _CLIENTUSERID=%BQUOTE(tom.abernathy);
 22         %LET _CLIENTUSERNAME=%BQUOTE(tom.abernathy);
 23         %LET CLIENTMACHINE=%BQUOTE(148.168.40.5);
 24         %LET _CLIENTMACHINE=%BQUOTE(148.168.40.5);
 25         %let SASWORKLOCATION="%sysfunc(getoption(work))/";
 26         FILENAME _CWD '.';
 27         DATA _NULL_;
 28         CALL SYMPUT('_SASWORKINGDIR',PATHNAME('_CWD'));
 29         RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 30         FILENAME _CWD;
 NOTE: Fileref _CWD has been deassigned.
 31         
 32         %LET _SASPROGRAMFILE = %NRQUOTE(%NRSTR(Program 1));
 33         %LET _BASEURL = %BQUOTE(https://odamid-usw2.oda.sas.com/SASStudio/);
 34         %LET _EXECENV=SASStudio;
 35         DATA _NULL_;
 36         CALL SYMPUT("GRAPHINIT","");
 37         CALL SYMPUT("GRAPHTERM","");
 38         RC=TSLVL('SASXGOPT','N');
 39         _ERROR_=0;
 40         IF (RC^=' ') THEN DO;
 41         CALL SYMPUT("GRAPHINIT","GOPTIONS RESET=ALL GSFNAME=_GSFNAME;");
 42         CALL SYMPUT("GRAPHTERM","GOPTIONS NOACCESSIBLE;");
 43         END;
 44         RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 45         DATA _NULL_;
 46         RC=SYSPROD("PRODNUM002");
 47         IF (RC^=1) THEN DO;
 48         CALL SYMPUT("GRAPHINIT","");
 49         CALL SYMPUT("GRAPHTERM","");
 50         END;
 51         RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 52         %LET _DATAOUT_MIME_TYPE=;
 53         %LET _DATAOUT_NAME=;
 54         %LET _DATAOUT_TABLE=;
 55         %LET _DATAOUT_URL=;
 56         %SYMDEL _DATAOUT_MIME_TYPE _DATAOUT_NAME _DATAOUT_URL _DATAOUT_TABLE;
 57         %LET _SASWS_ = %BQUOTE(/home/tom.abernathy);
 58         %LET _SASWSTEMP_=%BQUOTE(/home/tom.abernathy/.sasstudio/.images/551b6512-45e9-4c4b-8400-4cb3879218d5);
 59         ODS LISTING CLOSE;
 60         ODS AUTONAVIGATE OFF;
 61         ODS GRAPHICS ON;
 62         ODS HTML5 (ID=WEB) DEVICE=PNG GPATH="&_SASWSTEMP_" ENCODING=utf8  FILE=_HTMLOUT (TITLE='Results: Program 1')
 62       ! STYLE=Htmlblue OPTIONS(BITMAP_MODE='INLINE' OUTLINE='ON' SVG_MODE='INLINE'
 62       ! CSS_PREFIX='.ods_551b6512-45e9-4c4b-8400-4cb3879218d5' BODY_ID='div_551b6512-45e9-4c4b-8400-4cb3879218d5' );
 NOTE: Writing HTML5(WEB) Body file: _HTMLOUT
 63         &GRAPHINIT;
 64         OPTIONS FIRSTOBS=1;
 65         OPTIONS OBS=MAX;
 66         OPTIONS DTRESET DATE NUMBER NOTES;
 67         OPTIONS NOSYNTAXCHECK;
 68         
 69         proc print data=sashelp.class;
 70         run;
 
 NOTE: There were 19 observations read from the data set SASHELP.CLASS.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.02 seconds
       cpu time            0.03 seconds
       
 
 71         
 72         OPTIONS NOSYNTAXCHECK;
 73         ODS HTML CLOSE;
 74         &GRAPHTERM; ;*';*";*/;RUN;QUIT;
 75         QUIT;RUN;
 76         ODS HTML5 (ID=WEB) CLOSE;
 77         
 78         FILENAME _GSFNAME;
 NOTE: Fileref _GSFNAME has been deassigned.
 79         DATA _NULL_;
 80         RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 81         OPTIONS NOTES STIMER SOURCE SYNTAXCHECK;
 82         

 

Sajid01
Meteorite | Level 14
My point is, if there are options that are needed across all sessions,
it is better to set them in the configuration files.
This is something I would prefer to do.
I know there could be other good and wonderful approaches.
Quentin
Super User

@andreas_lds wrote:

@Shmuel wrote:

...

If you want that some options will be automaticaly set for all sessions  in future, you can add the options statement in the autoexec.sas program. 

...


This doesn't work with SAS Studio, because the mentioned options are set automatically each time code is executed. So the only "solution" i can see, is using %include as first statement in each program loading/executing a program containing all options that one wants not be change by stupid automatism.


I haven't used Studio, but (as described in the linked documentation), that Studio behavior of resetting a list of options for every code submission is pretty scary to me.

 

EG also adds wrapper code which resets options for every submission.  But most of those options are at least configurable in by a user in EG.  So you can set the values you want.  EG also allows a user to define "pre-code" that can be automatically added to every submission, which would be another way to solve this problem.

 

In general, SAS seems to make IDE's more and more programmer friendly over time.  I would think a ballot item to make these system options configurable by the Studio user (and/or Studio admin) would be a good idea. 

 

And maybe another ballot submission about Studio user-configurable precode.  EG does it very nicely.  You can specify precode/postcode for session start/end, and separately specify precode/postcode for every submission.

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.
Sajid01
Meteorite | Level 14

The SASv9.cfg and Autoexec.sas (and the usermod versions) are read when SAS sessions starts.
You are using SAS Studio and provided you run the code from the SAS studio in the normal course any option set in the .cfg OR autoexec files should be available to all programs.
If you are having any issue do seek assistance from your SAS administrator. If you have any further questions, please let us know a bit more about your environment.

Patrick
Opal | Level 21

The link to the docu @BenoîtOry shared clearly states that these are options SAS Studio resets for every single code execution which will overwrite anything you define in a .cfg or autoexec that gets executed during SAS invocation.

 

@BenoîtOry  What might help is to define Custom SAS Code for SAS Studio which then sets the options as you want them. If that works like for SAS EG then such a definition is user specific but for all projects and the code should execute after the SAS Studio generated one.

 

Sajid01
Meteorite | Level 14

What @Patrick  has indicated is about the option the user sets.
However if all options are set in Autoexec or sasv9 they should persist. It will be wonderful if @BenoîtOry  gives it a try,

SASKiwi
PROC Star

@Sajid01 - What @Patrick says is correct. Regardless of what you put in your AUTOEXEC or CONFIG files, certain options like VALIDVARNAME get reset everytime you submit any code in SAS Studio. I just checked this in Version 3.81 and that is indeed the way it behaves.

 

Personally I find this really annoying. It is another example of where SAS Studio behaviour differs from Enterprise Guide and the SAS Windowing System. For example if you are migrating from SAS 9 / EG to SAS Viya / SAS Studio and your application relies on VALIDVARNAME always being set to V7, then you can't rely on AUTOEXEC or CONFIG files to set the option the way you want, nor can you set the option in one program and expect it to retain the setting for the rest of your SAS session. AFAIK, there is no global way of changing this behaviour. 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 22 replies
  • 3139 views
  • 11 likes
  • 11 in conversation