<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Invoke SAS to run a macro automatically in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invoke-SAS-to-run-a-macro-automatically/m-p/116712#M24099</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;classmeans.sas&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;libname mylib 'c:\data\test';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc summary data=sashelp.class nway;&lt;BR /&gt;class sex age;&lt;BR /&gt;var height weight;&lt;BR /&gt;output out=mylib.class_sum (drop=_:) mean=;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;classmeans.cmd&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;"C:\Program Files\SAS\SASFoundation\9.2\sas.exe" -sysin c:\data\test\classmeans.sas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 May 2012 15:52:28 GMT</pubDate>
    <dc:creator>FloydNevseta</dc:creator>
    <dc:date>2012-05-16T15:52:28Z</dc:date>
    <item>
      <title>Invoke SAS to run a macro automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invoke-SAS-to-run-a-macro-automatically/m-p/116711#M24098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If yes, what do i need to do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards and thnx in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 14:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invoke-SAS-to-run-a-macro-automatically/m-p/116711#M24098</guid>
      <dc:creator>chemicalab</dc:creator>
      <dc:date>2012-05-16T14:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke SAS to run a macro automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invoke-SAS-to-run-a-macro-automatically/m-p/116712#M24099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;classmeans.sas&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;libname mylib 'c:\data\test';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc summary data=sashelp.class nway;&lt;BR /&gt;class sex age;&lt;BR /&gt;var height weight;&lt;BR /&gt;output out=mylib.class_sum (drop=_:) mean=;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;classmeans.cmd&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;"C:\Program Files\SAS\SASFoundation\9.2\sas.exe" -sysin c:\data\test\classmeans.sas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 15:52:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invoke-SAS-to-run-a-macro-automatically/m-p/116712#M24099</guid>
      <dc:creator>FloydNevseta</dc:creator>
      <dc:date>2012-05-16T15:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke SAS to run a macro automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invoke-SAS-to-run-a-macro-automatically/m-p/116713#M24100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is not hard, you can do it the same way you would schedule any other job to run.&lt;/P&gt;&lt;P&gt;It will depend on your operating system.&amp;nbsp; If you are using Unix then you can use cron.&amp;nbsp; If it is windows then you will need to use a similar tool for Windows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically on any system you can run SAS non-interactive by issuing the command: sas filename &lt;/P&gt;&lt;P&gt;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.&amp;nbsp; Once you have that working then schedule it to run when every you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 15:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invoke-SAS-to-run-a-macro-automatically/m-p/116713#M24100</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-05-16T15:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke SAS to run a macro automatically</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invoke-SAS-to-run-a-macro-automatically/m-p/116714#M24101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thnx guys for your insight i tried it and i got it to work&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 19:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invoke-SAS-to-run-a-macro-automatically/m-p/116714#M24101</guid>
      <dc:creator>chemicalab</dc:creator>
      <dc:date>2012-05-16T19:30:31Z</dc:date>
    </item>
  </channel>
</rss>

