Desktop productivity for business analysts and programmers

cleaning 'sasuser' library

Regular Contributor
Posts: 220

cleaning 'sasuser' library

Hello community

we are running SAS application (eg) on server machine only. users used to save their work (temporary kind of work) on 'SASUSER' library (eg session work) and i have tried to clean only sas data sets (.sas7bdat) (I think this library is not temporary as well as not permanant where we can save work all the time...and that is y i planned to clean that up on weekly bases on WINDOWS environment). I ran following command in BAT file but it failed to clean it, however i don't see anything wrong in command line...

can anyone please suggest/help on this how can i cleanup 'SASUSER' library with sas data sets only (.sas7bdat) on server itself...


set LogDir="f:\prodn\log"

cd \

DEL C:\Documents and Settings\ussasadmin\My Documents\My SAS Files\9.1\*.sas7bdat

echo cleanup has been done at 'C:\Documents and Settings\ussasadmin\My Documents\My SAS Files\9.1' >>%logdir%\temp_cleanup.log
date /t >> %logdir%\temp_cleanup.log
time /t >> %logdir%\temp_cleanup.log
echo. >> %logdir%\temp_cleanup.log



Thanks all!

Occasional Contributor
Posts: 9

Re: cleaning 'sasuser' library


Would not a proc datasets procedure work?

You can use the memtype = data to delete only the datasets.



Regular Contributor
Posts: 220

Re: cleaning 'sasuser' library

I am familiar with that process but i am not sure if it will delete 'profile file' and 'registry files' too...I don't want to delete those files since this is 'SASUSER' library...

Valued Guide
Posts: 3,206

Re: cleaning 'sasuser' library

sandy,  Your problem is now well described.  SASUSER and the personal data storage.

The batch file has the issue you have to know all users and have all acessrigts there. They probably not running under "ussasadmin"but under their own key. So  C:\Documents and Settings\ussasadmin\My Documents\My SAS Files\9.1\*.sas7bdat  will not work.

SASuser is meant to be personal  connected to the %USERPROFILE% of windows. A more adavanced reference is used.

Trying to force people not using their "My documents" etc while Microsoft is pushing them direction is a losing game.

The better approach would be a setting they are not tempted that easy storing data in SASUSER.  

With Eguide usage this SASuser location is set often read-only within SAS by default.  You are describing a DMS approach (SAS base). The storing of data with 1-level names is a easy approach of coding and can be influenced.


The issue of the sasuser usage can be solved different. SAS(R) 9.3 Companion for Windows (user= system option).

You could set it to the same as WORK. But by default this location is %TEMP% also bound to be to the personal key.
There must be a location for user-modifications in the at your installation.

---->-- ja karman --<-----
Regular Contributor
Posts: 220

Re: cleaning 'sasuser' library

Hi Japp - i have chcked it and its running using 'ussasadmin' user id only. property if the library (SASUSER) is as follow;


engine- v9

readonly - yes

temporary - no

so i think wourkaround might  be

- forcing directory to delete sas data sets  by putting some special character in command line

and then may need to provide new library to users to save their work...rather than use 'SASUSER' library to storing eg session/work


Regular Contributor
Posts: 220

Re: cleaning 'sasuser' library

i have created some sas data sets and views in test library and below code is deleting sas datasets only, leaving view undeleted - but still is it safe to run this code in as BAT file? and will it delete sas data sets in 'SASUSER' library which is 'READ' only?

libname xyz 'f:\xyz';

proc datasets lib=xyz kill memtype=data;



Valued Guide
Posts: 3,206

Re: cleaning 'sasuser' library

The proc datasets,  with 9.4 proc delete is back, is the best way to clean up SAS managed data/content. (ODS and OMI to be added).

You could run this SAS code by a SAS batch-job using a batch file.

Keep it simple (KISS) the one (owner/process) creating the rubbish should also do the cleanup. In excptions a Garbage clean service.

The issue you are possible running into is locking. Locking is well known from databases.  It first implementation was on mulituser OS.

When someone has locked a record somebody else cannot use that record in the same way. 

To overcome the dealocks for updating you can tell just doing reads.

Windows is now multiuser and can do locking. The Original DOS 2.1 single user single machine was missing that.

  Even weird behavior can oocur like: Configuring opportunistic locking in Windows

Unix has been designed for multiuser but is mostly missing a multiuser implementation. Phones - routers etc a single proces person.

Old guy Mainframe was the most strict on this (disp=..) .  

That should be background knowledge.

SAS is running on top of and OS and has to follow what is delivered by that.

Filelocks are possible. Setting a directory for read-only will have the access for read-only no updates (including deletes).

You cannot change that be defining an other libname it will reuse the old ones (trying to disconenct/connect first).   

Seen you last note accessing the server, you are moving form old SAS base/foundation to using BI/DI with Eguide. With Eguide the SASuser is closed (read-only) no garbage will be created anymore.


- Do a cleanup for one time

- go for you users to implement and support something that is workable for temp/permanent datasets

---->-- ja karman --<-----
Regular Contributor
Posts: 220

Re: cleaning 'sasuser' library

I have ran proc datasets lib=sasuser kill  memtype=data to kill datasets under 'SASUSER' library (c:\.....) it ran successfully but didn't cleanup datasets, no error in the log.

I took a look into system security and figured that userid this batch job running with is in not 'ADMINISTRATOR' group. userid is in 'SAS SERVER USER' group list but not in 'ADMINISTRATOR' group...and that might the case it ran but didn't cleanup also might possible i am running this batch job from 'f:\', share drive, and trying to clean something in 'c:\' drive...

Valued Guide
Posts: 3,206

Re: cleaning 'sasuser' library

Sandy you are now possible running into the UAC Windows  quirks behavior.

Running as administrator (or root) is not appreciated and all kind of technical mitigations are introduced to disencourage that.

It is a littlebit painful SAS institute is not doing well at those requirements and their related effects.

Some examples:

- You can not use a "domain admin" to be used with SAS spawners and scheduling having it kept those rights

  As the "local service" account is running those processes and that one is not allowed to elevate rights to admin. (MS design)

- Some procedures are requiing attention Using SAS92HFADD &amp; ViewRegistry on Windows Server 2008 R2 -

-  Others like:

18274 - When you use the MEMCACHE or MEMLIB system options the following error message occurs "Error...

43425 - The error "SETINIT: FAILED. Install will now abort" occurs during installation of SAS® 9.2 o...

Bypassing or ingoring UAC (virusscanners firewalls and others) going back to the stone-age when security was not important is not very advisable.Only when you can oversee the impact and consequences on it is acceptable

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 8 replies
  • 1 like
  • 3 in conversation