BookmarkSubscribeRSS Feed
ScottBass
Rhodochrosite | Level 12

Hi,

I'm not sure if this post should be here or in SAS Deploy.  Apologies if it should go there instead of here.

We have end users that can't get the concept of a Cartesian product.  In the worst case scenario, our work space gets filled, ETL jobs bomb, and everyone gets angry.

Now, I know I can jump through some hoops to get the owner of a particular physical work directory.  What I'm wondering is if there is some edit I can do to the global configuration file so that the userid that owns the particular SAS process is also a part of the physical name.

IOW, I want to change this:

_TD10996_MYSERVERNAME_

to

_TD10996_USERID_MYSERVERNAME_ 

Can this be done?

Regards,

Scott


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
11 REPLIES 11
ScottBass
Rhodochrosite | Level 12

All our work and SAS Util directories are on a specific drive on our server reserved just for that purpose.  This prevents a runaway job from consuming space on a single communal drive.

SAS creates the work sub-directories under this root directory.  Since SAS obviously knows the process ID, and since the process ID has an owner, I was hoping to coax SAS into adding that owner to the generated physical directory name.


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
ArtC
Rhodochrosite | Level 12

The userid is stored in the automatic macro variable &SYSUSERID.  The data set name becomes something like:

_TD10996_&SYSUSERID._MYSERVERNAME_

ScottBass
Rhodochrosite | Level 12

Hi Art,

1) The SAS Work and SAS Util directories are created upon SAS invocation.  I don't believe &sysuserid would be available at that time.

2) If this understanding is incorrect, how would you set this in the system wide configuration file?  I know I can set the -work and -util root directories, but I believe _TD_<processid>_<machinename>_ is baked into SAS.  I was hoping there is some unknown to me option that would allow me to change this naming convention.

I guess there could be some repercussions I need to think about.  For example, it could break the "cleanwork" utility.

Regards,

Scott


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
Ron_MacroMaven
Lapis Lazuli | Level 10

-SET SASROOT "C:\Program Files\SASHome\SASFoundation\9.3"

examine your configuration file:

!sasroot\nls\en\sasv9.cfg

and find the definition of the various work options and environmental variables (-set):

-SET MYSASFILES "?CSIDL_PERSONAL\My SAS Files\9.3"

-SASUSER "?CSIDL_PERSONAL\My SAS Files\9.3"

-WORK "!TEMP\SAS Temporary Files"

note: ?CSIDL_PERSONAL

is.a API call

solution:

create a personal sasv9.cfg file

and, for your use,

add your UserId into the path name(s)

instructions are on this page:

http://www.sascommunity.org/wiki/Batch_processing_under_Windows

Ron Fehd startup maven

Peter_C
Rhodochrosite | Level 12

Hi Ron

I really hope you might be able to come along and judge my paper in systems architecture

Configuring foundation SAS Clients easily and with less risk

It seems to invade the teritory your link describes  (I'm sorry) without any reference to your community article.

I hope you'll agree that the new paper is adding some new ideas that are worth hearing.

(it should also become available on Takeout if your schedule is overloaded)

regards

Peter

Ron_MacroMaven
Lapis Lazuli | Level 10

Hi Peter

I would be glad to monitor your paper.

Plz send me an e-mail with your day and time.

Ron.Fehd.macro.maven@gmail.com

Peter_C
Rhodochrosite | Level 12

like Ron, I have a -WORK that does not define the machine name, but it still appears in the directory name generated by SAS for the work directory that it uses.

although &SYSUSERID is not available BEFORE SAS starts, among environment variables on my machine (default vista business) is USERNAME which looks like the source for &SYSUSERID.

adapting the invocation of SAS to use a -work like

-WORK "!TEMP\SAS Temporary Files\!userName"

achieved exactly what Scott seeks

C:\Users\{user account reduced to 8.3 name}\AppData\Local\Temp\SAS Temporary Files\{full user account ID}\_TD{processID}_{computer name}_

ArtC
Rhodochrosite | Level 12

Teach me not to read the question more closely.  Might there be a system environmental variable that contains that information?  If so then it could be used in Ron's solution, and thus avoiding multiple CFG files.

Ron_MacroMaven
Lapis Lazuli | Level 10

Hi Art

Yes, we can!

Here are some of the Windows Environment Variables that can be fetched with %sysget

%put ComputerName: %sysget(ComputerName);

%put LogOnServer: %sysget(LogOnServer);

%put UserDomain: %sysget(UserDomain);

%put UserName: %sysget(UserName);

%put UserProfile: %sysget(UserProfile);

%Let Evar = temp;

%put &Evar %sysget(&Evar);

%Let Evar = tmp;

%put &Evar %sysget(&Evar);

Ron Fehd  Eeek!-Var maven

refer to

http://www.sascommunity.org/wiki/Category:Environment_Variables

btw: why do we want to assign Unix Evars to Mvars?

Peter_C
Rhodochrosite | Level 12

Like Ron, I wouldn't know why anyone would want to transfer %sysget(eVar) to &eVar especially when an eVar  might not be valid as a macro variable name

to load all eVars to a table, I use

data env_vars ;

length name $40 value $1024 ;

infile 'set ' device= pipe lrecl=2048 truncover ;

input ; list;

pos = find( _infile_, '=' ) ;

if pos ; * sometimes there is no = ;

name  = substr( _infile_,1, pos-1 ) ;

value = substr( _infile_, pos+1 ) ;

* call symputx( name, value) ;

run;

The LIST statement provides a useful echo of all eVars into the SASlog

uncomment the call symputx() if you want all eVars as macro variables.

peterC

FredrikE
Rhodochrosite | Level 12

Hi!

Another way to handle this maybe?!

We created another server context (SASAppBatch) for our batches. That server context has its own work (and own file system) which will make batches and other "important" taskt to always run.

Users have no acces to this server context  and are restricted to use SASApp.

We also have other memory settings on this context so that all tasks will run without problems!

//Fredrik

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 11 replies
  • 2235 views
  • 4 likes
  • 5 in conversation