Desktop productivity for business analysts and programmers

making BAT file to delete SAS dataset

Accepted Solution Solved
Reply
Regular Contributor
Posts: 220
Accepted Solution

making BAT file to delete SAS dataset

Hi friends - i am making one BAT files which will clear SAS 'WORK' folder, I am also planning to include one more folder path in same BAT file which would clear 'x' folder which has SAS DATASETS as well as below three files...

regstry.sas7bitm

profile.sas7bcat

profile2.sas7bcat

I don't think BAT files will keep these files in place once i set it up, it will clear everything including above files...so is it okay to clear above files in 'X' folder too, becasue i have seen same files as above in SAS temporary 'WORK' folder where we can delete these.

Thanks!


Accepted Solutions
Solution
‎08-02-2013 03:22 PM
Trusted Advisor
Posts: 3,208

Re: making BAT file to delete SAS dataset

Sandy,

These files are normally the personal user settings loacted in the %USerprofile% hierarchy (appdata).   

SAS has his own registry procedure like the Windows registry.

They can get corrupted and when this happens the repair action is the delete.  New fresh copies will be made at next startup.

By that losing all settings that have been made as custom/personal.

They are appearing at saswork because of multiple usage requiring an update access, to avoid locking /write issues a fresh copy at work is used.

When there are modified settings explicitly placed you have to adress that.

Work folders can be cleaned totally when no related process is running.  Not only ""sas-"" datasets can reside at saswork but almost every type.

---->-- ja karman --<-----

View solution in original post


All Replies
Solution
‎08-02-2013 03:22 PM
Trusted Advisor
Posts: 3,208

Re: making BAT file to delete SAS dataset

Sandy,

These files are normally the personal user settings loacted in the %USerprofile% hierarchy (appdata).   

SAS has his own registry procedure like the Windows registry.

They can get corrupted and when this happens the repair action is the delete.  New fresh copies will be made at next startup.

By that losing all settings that have been made as custom/personal.

They are appearing at saswork because of multiple usage requiring an update access, to avoid locking /write issues a fresh copy at work is used.

When there are modified settings explicitly placed you have to adress that.

Work folders can be cleaned totally when no related process is running.  Not only ""sas-"" datasets can reside at saswork but almost every type.

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

Re: making BAT file to delete SAS dataset

Hi Jaap - if i understand you correctly i cannot delete all these files under 'X' folder same as i can do with 'WORK' folder, right? i would rather write a SAS code to delete just sas datasets under 'X' folder?

Thanks!

Super User
Super User
Posts: 6,851

Re: making BAT file to delete SAS dataset

Those files are normally in the SASUSER library.

Personally I use the -RSASUSER option to prevent SAS from modifying my SASUSER files while I am running jobs.

I am not sure if the -RSASUSER option is available (or if it translates well) to setups that are using SAS application servers instead of just running SAS from the operating system.

Regular Contributor
Posts: 220

Re: making BAT file to delete SAS dataset

is following command will work to delete only sas7bdat extension and leave all rest 3 files extensions (.sas7bitm, .sas7bcat)?

:: to delete only .sas7bdat extension

del x:\Documents and Settings\9.1\*.sas7bdat

:: to clear temp folder

rmdir c:\work\temp /s /q

Thanks!

Trusted Advisor
Posts: 3,208

Re: making BAT file to delete SAS dataset

Sandy,

I am puzzeld what your intention is. Because:

- The SASwork will get random names normally (windows) below the %temp% user environment.

This area will be cleaned up when SAS normally stops. The Windows clean up should be extended at installation time to clean up left rubbish of abended processes. Are you a Windows admininstrator the user %temp% should be cleaned regular in generic as of possible leaking data.  

This is normally not c:\temp as Windows has become a multi-user OS.

- If your problem is cleaning up SASwork as part of your logical processing the best way is use the SAS facilties, as there are;

  Base SAS(R) 9.4 Procedures Guide (PROC DATASETS) with  kill all or delete a selection of the datasets. With 9.4 the Base SAS(R) 9.4 Procedures Guide the delete procedure is added to make this easier.

  If you would prefer SAS(R) 9.4 SQL Procedure User's Guide PROC SQL you have drop table. 

- There are a lot more SAS statements to access and maintain OS files bypassing all X statement requitement of batch scripting.

  This is one of the oldest parts of SAS and mostly got hiddem in all datastep processing capabilities and fucntions. 

An handy one is the SAS(R) Component Language 9.4: Reference pathname function. Returning the physical name of a logical one, like SASwork SASuser. 

- Just wanting to cleanup SAS-datasets or files like using Windows-Explorer?

  All is possible with SAS Explorer and the Eguide file-list.  Just use the mouse.

- There are situations to imagine an OS scritp is giving advantages,

That is when there are no SAS functions/logic and/or needing specific features of the OS like Xcacls (security administration).  

As said the SASuser is the standard for the personal settings. Sometimes it is used to drop all kind of data in it because of missing conventions where the data should be stored. Sometimes it is used for samples and educational files.

@Tom, normally the SASuser in a WS / SP is set as readonly (the -rsasuser option) as being set up to run to server multiple processes.

The only exception with that is the DMS base-sas approach as the only one knowing he is starting a second one or not, is the operator. The operator, that is the person starting SAS, the sas-user.     

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

Re: making BAT file to delete SAS dataset

Hi Jaap - i really appreciate your type -

my only concern is i am planning to make one BAT file which would clear datasets (.sas7bdat) in particular folder and i am not sure if i have to delete below files along with data sets in that folder or have to keep it...(and this is not sas 'work' folder i am taking about, this folder is located @ "x:\Documents and Settings\9.1")


thanks...

regstry.sas7bitm

profile.sas7bcat

profile2.sas7bcat


Super Contributor
Posts: 356

Re: making BAT file to delete SAS dataset

Hi Sandy,

I suppose the first question we should ask is what problem are you trying to resolve?

Are you just trying to clear the work library or something more? as writing a dos BAT file may not be the best way to do this. an example is if you have say a file data set with an index in your  folder, your method will only remove the data set and not the index.

Regards

Barry

Regular Contributor
Posts: 220

Re: making BAT file to delete SAS dataset

Hi Barry -

Not only temporary work library folder (i have written BAT file which will clear everything under temporary work folder: subfolder, files and datasets and evreything) but also other folder where users are used to store some temporary datasets and i am going to add below command in same BAT file. so simply, i am wondering is it okay to delete all these file (regstry.sas7bitm, profile.sas7bcat, profile2.sas7bcat) along with .sas7bdat extension for 'X' folder or i have to keep all these files.

As i have added below code in the BAT file it will delete only ".sas7bdat" extension but i was wondering if its okay to delete every extensions (.sas7cdat, .sas7bitm). 

del x:\Documents and Settings\9.1\*.sas7bdat

Basically I am planning to handle two things at a time, cleaning temporary 'work' folder and cleaning only .sas7bdat extension in 'X' folder...in one BAT file...

thanks!

Trusted Advisor
Posts: 3,208

Re: making BAT file to delete SAS dataset

Sandy,
Barry is the second person asking you why you would do this....

As most things are already build and available...

SAS(R) 9.3 Companion for Windows (The SAS Disk Cleanup Handler Utility). 

Why trying to invent something that is already available? Or are we missing something

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

Re: making BAT file to delete SAS dataset

Jaap - this is not about only SAS Disck cleanup handler utility - i have created bat file which will take care of that part - my question is more about another folder (x) where i want to delete sas datasets but i am not sure to DELETE OR KEEP this extension too ('.sas7bitm', and '.sas7bcat') --- so basically i am waiting for GO or NO-GO decision...

Thanks!

Super Contributor
Posts: 356

Re: making BAT file to delete SAS dataset

Sandy

You can delete all file types in non-sas configuration locations -  if it is just a sas library location even better.  As mentioned above by Jaap be mindful of the SAS user location. 

Search the sas support site for the file extensions and you should be able to find what the file is used for.

Cheers

Barry

Regular Contributor
Posts: 220

Re: making BAT file to delete SAS dataset

I got it - Thanks all for your time and your input...

Sandip

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 703 views
  • 3 likes
  • 4 in conversation