BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
gabonzo
Quartz | Level 8

Hi,

 

my user folder is getting cluttered by hundreds of plots and histograms. When I close SAS, the folder is not emptied, and I have to do it manually.

 

Is there an option to force SAS to clean the user area from temporary plots?

 

I am using SAS 9.4

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

@gabonzo wrote:

Still, I would prefer to have SAS do a proper cleaning on it own 😉

You could set the default path for those files to the WORK folder, which in general (as you know) is automatically deleted at the end of a SAS session. Again, the autoexec.sas would be a suitable place for a statement such as

ods listing gpath="%sysfunc(pathname(WORK))";

(For HTML files, if any, there is a checkbox "Use WORK folder" in Tools --> Options --> Preferences... --> Results.)

View solution in original post

7 REPLIES 7
ballardw
Super User

If you can run X statements or %sysexec you might just write a small program line or two and put it in your autoexec.sas file

 

Something like

 

x 'del c:\pathtouserlibrary\*.png'

x 'del c:\pathtouserlibrary\*.html'

 

or have that as an autocall macro to call when needed

 

gabonzo
Quartz | Level 8
It's not a bad idea per se, I could do that in autoexec.sas

Still, I would prefer to have SAS do a proper cleaning on it own 😉
FreelanceReinh
Jade | Level 19

@gabonzo wrote:

Still, I would prefer to have SAS do a proper cleaning on it own 😉

You could set the default path for those files to the WORK folder, which in general (as you know) is automatically deleted at the end of a SAS session. Again, the autoexec.sas would be a suitable place for a statement such as

ods listing gpath="%sysfunc(pathname(WORK))";

(For HTML files, if any, there is a checkbox "Use WORK folder" in Tools --> Options --> Preferences... --> Results.)

gabonzo
Quartz | Level 8
Yes, that would be the ideal solution. Thank you!
gabonzo
Quartz | Level 8

Ok, but please help me here:

I looked in the Tools --> Options --> Preferences... --> Results window, and the "Use WORK folder" checkbox was already set.
I still get the results html file in the user folder, what am I doing wrong?

ballardw
Super User

@gabonzo wrote:

Ok, but please help me here:

I looked in the Tools --> Options --> Preferences... --> Results window, and the "Use WORK folder" checkbox was already set.
I still get the results html file in the user folder, what am I doing wrong?


The options list check box for results is basically setting the behavior for the one level data set name. If you have a USER library then one level names go there, not the actual WORK library. And USER libraries don't get cleaned. I did find that if you uncheck "Use Work folder" and change active directories frequently you can end up with HTML and PNG scattered all over your drive.

 

If you do not want HTML files in the USER library you would  have to do something else. I haven't quite figured out a real good alternative. You could send ALL of your HTML to another specific folder but it would not get cleaned up either but they won't be in the USER library. Just set a specific path under the Create HTML and uncheck the "use work folder"  I basically don't worry about it much and just clean up my USER library with a script periodically.

gabonzo
Quartz | Level 8

Ok, I think I got it. If you use:

ods html gpath="%sysfunc(pathname(WORK))";

Then the image files are sent to the work directory, but the HTML file is sent to the user directory.

 

If you instead use:

ods html path="%sysfunc(pathname(WORK))";

Then both the HTML file and the images are sent to the work directory. You could specify different path and gpath if you wanted to, but it's not what I need here.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 748 views
  • 4 likes
  • 3 in conversation