Hi all,
I am just wondering if it is possible to invoke SAS without me having to initiate it in order to run a macro for a specific day.
In a nutshell if i want SAS, to run a proc means for example on a dataset at a specific day /time is it possible without me having to open SAS??
If yes, what do i need to do?
Kind regards and thnx in advance
Here's a quick way. Let's say I have this simple program that runs a simple summary. I saved it in the same folder specified in the libname statement.
classmeans.sas
libname mylib 'c:\data\test';
proc summary data=sashelp.class nway;
class sex age;
var height weight;
output out=mylib.class_sum (drop=_:) mean=;
run;
My OS is Windows XP. I created a batch file to execute the SAS program. Your path to the SAS executable may be different than mine. I saved the file in the same directory as the SAS program.
classmeans.cmd
"C:\Program Files\SAS\SASFoundation\9.2\sas.exe" -sysin c:\data\test\classmeans.sas
In the Control Panel, I ran the Scheduled Tasks task. When prompted for the program I wanted to schedule, I browsed to the c:\data\test folder where the classmeans.cmd file was located and selected it. I continued to follow the prompts to create the scheduled job. For this example, I scheduled it once to run 1 minute after creation of the job. I just wanted to make sure it worked. The summary file was created as scheduled.
Here's a quick way. Let's say I have this simple program that runs a simple summary. I saved it in the same folder specified in the libname statement.
classmeans.sas
libname mylib 'c:\data\test';
proc summary data=sashelp.class nway;
class sex age;
var height weight;
output out=mylib.class_sum (drop=_:) mean=;
run;
My OS is Windows XP. I created a batch file to execute the SAS program. Your path to the SAS executable may be different than mine. I saved the file in the same directory as the SAS program.
classmeans.cmd
"C:\Program Files\SAS\SASFoundation\9.2\sas.exe" -sysin c:\data\test\classmeans.sas
In the Control Panel, I ran the Scheduled Tasks task. When prompted for the program I wanted to schedule, I browsed to the c:\data\test folder where the classmeans.cmd file was located and selected it. I continued to follow the prompts to create the scheduled job. For this example, I scheduled it once to run 1 minute after creation of the job. I just wanted to make sure it worked. The summary file was created as scheduled.
It is not hard, you can do it the same way you would schedule any other job to run.
It will depend on your operating system. If you are using Unix then you can use cron. If it is windows then you will need to use a similar tool for Windows.
Basically on any system you can run SAS non-interactive by issuing the command: sas filename
Where sas is the command to run SAS on your system and filename is the name of the SAS program (most of which could be a macro call) that you want to run. Once you have that working then schedule it to run when every you want.
Thnx guys for your insight i tried it and i got it to work
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.