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

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

1 ACCEPTED SOLUTION

Accepted Solutions
FloydNevseta
Pyrite | Level 9

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.


View solution in original post

3 REPLIES 3
FloydNevseta
Pyrite | Level 9

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.


Tom
Super User Tom
Super User

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.

chemicalab
Fluorite | Level 6

Thnx guys for your insight i tried it and i got it to work

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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