BookmarkSubscribeRSS Feed
Peter_L
Quartz | Level 8

I recently made a useful discovery which may help others configure SAS 9.2 on Windows 7 or other versions. My motivation was to move the SASUSER library away from "My Documents" because that location was redirected to a slow network share, which caused occasional errors with the profile and its backup file.

The SAS configuration file SASV9.CFG by default has -SASUSER "?CSIDL_PERSONAL\My SAS Files\9.2". ?CSIDL_PERSONAL resolves to C:\Users\USERID\Documents or wherever that is redirected. I changed it to put it one level higher like so: -SASUSER "?CSIDL_PROFILE\My SAS Files\9.2". You could argue that this is more consistent with common Windows usage, where "My" folders appear directly under the profile home.

It turns out that SAS will understand several of these CSIDL identifiers; I also tried CSIDL_APPDATA. They are deprecated since Windows Vista but while they are still used by SAS, predumably we may still use them. There is a list of variables here: CSIDL (Windows).

These variables may also be used in -SET MYSASFILES and in -SASINITIALFOLDER.

It would be considerate of SAS to document this use of CSIDL variables in the configuration file. For example, !TEMP looks as if it might be a way to refer to environment variables generally, but !OTHER_VAR does not work. If you look with %SYSGET() you will also discover that -SET itself does not expand the CSIDL reference; it happens somewhere else. SAS seems to have embraced and extended the complexity in Windows environment definitions.

Peter Lancashire

2 REPLIES 2
Ksharp
Super User

There is a global option to change default SASUSER library.

libname x v9 'c:\temp';

options user=x ;

Also can change WORK library.

options work=x;

Xia Keshan

ronan
Lapis Lazuli | Level 10

I confirm Peter's most useful post on all and every points :

1) ?CSIDL_PERSONAL on Win 7 resolves to the location of "My Documents" which is sometimes synchronised with a network share (My Documents Synchronized vs My local Documents)

2) the system synchronisation process might conflict with the SAS session updating SASUSER content, especially SAS profile catalog, SAS registry (itemStore) or Template Store.

3) changing ?CSIDL_PERSONAL with ?CSIDL_PROFILE seems like a functional workaround


4) unfortunately Windows Companion Guide 9.2 doesn't include the slightest reference to ?CSIDL_PERSONAL or %USERPROFILE% dynamic environment variables set up for SASUSER location

5) During the very first steps of SAS Windows launching process (eg Scope = Kernel), for instance when the SASV9.cfg is loaded, as a general rule no system environment variable can be expanded

with the exception of !TEMP  (= %TMP%) or ?CSIDL_<suffix> . It begins further at the Autoexec or Initstmt levels. Furthermore SAS option value based on dynamic resolution (ex.  -OPTION "&macrovar" , OPTION "%sysget(SYSTEMVAR);) might

vary from one option to another . Run proc options with the DEFINE statement to know about it :


Proc Options option=<option name> define;

run;

SASINITIALFOLDER=

Option Definition Information for SAS Option SASINITIALFOLDER

    Group= ENVFILES

    Group Description: SAS library and file location information

    Description: Sets SAS's initial working folder. Also changes initial folder of Open and Save

                 As dialog to be current working folder.

    Type: The option value is of type CHARACTER

          Maximum Number of Characters: 260

          Casing: The option value is retained with original casing

          Quotes: If present during "set", start and end quotes are removed

          Parentheses: The option value does not require enclosure within parentheses. If

          present, the parentheses are retained.

          Expansion: Environment variables, within the option value, are not expanded

    When Can Set: Session startup (command line or config) only

    Restricted: Your Site Administrator can restrict modification of this option

    Optsave: Proc Optsave or command Dmoptsave will not save this option

Incidentally, I locked my SASUSER folders more than once because of this and I had to use Sysinternals "Handle" utility to identify the low level SMB/RDP  process involved in the system sync.

Even ProcessExplorer (with local admin privileges) could not display the system process Ids.:smileyplain:

The CSIDLs dynamic variables are supposed to be deprecated with Vista. They are closely linked to the registry keys stored at :

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

Meanwhile, starting in 9.4, SAS recommends using new System environment variables for the SASUSER library:

50713 - The SASUSER default location has changed in the SAS® 9.4 sasv9.cfg file for Windows operatin...

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 2 replies
  • 4974 views
  • 0 likes
  • 3 in conversation