Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a report automatically in SAS

Status
Not open for further replies.

ja01

Technical User
Dec 14, 2005
48
0
0
US
I have a report that creates a work table as follows
proc sql;
create table address as
select addrdate,addruserid
from d.address
where addrdate >= '05-feb-2007'd
order by addruserid;
quit;

1. Is there a way to have SAS run this report automatically at 4:00PM each day everyday and put it in the work library? Is this done through a macro
 
SAS doesn't have the ability to run on a schedule. That said, there are ways that you can get your code to run on a schedule.

1. The easiest is to always have your SAS program running (in sleep mode). This always fails over time as SAS is not memory efficient.
2. You can use a scheduler application (such as windows scheduler or its Unix equiv). This is what the Enterprise tool seems to use. You can do this by scheduling an application to run. (This is usually a DOS command line (or in Unix a Shell command)

Windows ex.
Navigate to the settings->control panel->Scheduled tasks - Add a Scheduled Task
1. Set up a task to run
2. make sure that a user/password is entered if your environment needs that
3. for the Command line (Run line) "yourSASfolder\sas.exe" -autoexec "yoursasfilename.sas"

This should launch the SAS program for you.

Now why you would want to put a table into a temp (work) library I can't answer. Each SAS session has their own work library. Therefor, if you have one SAS session create a temp table in its work library, another SAS session will not have access to that library. Perhaps, you would like to create a table that can be accessed by other programs. You can have your sas program create and age (proc datasets) it in a permanent place. All your sas programs would have access if you put the new libname statement at the top of the code.


I hope this helps you,
Klaz
 
I use a 3rd party package called Schedule Wizard and it does a great job of allowing me to schedule sas jobs.
It is from -
Vince Sorensen
Author Direct Shareware
directsales@authord.com
 
We currently run our SAS jobs in batch mode, but doesnt SAS close when its finished running in batch, and if so wouldnt you lose the data in the temp lib?

shenn
 
Yes Shenn, you lose the work datasets, so anything that you want kept needs to be written to a permanent library, or written out to a file or something.
Most periodic reports are based on data from a warehouse etc, and so the data doesn't always need to be kept, just reported.

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top