<?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 Automate Programs to run specific days and the user should be able to change which days to run in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749198#M235377</link>
    <description>&lt;P&gt;Assume I have created a program that includes different files to run for different days. I would like this program to run automatically, for instance every day 14.00. Since I have created this program to produce some output (for example creating a customer list) I would like the user (for instance a sales person) to be able to manually change which days he wants to receive this list (since the sales person is not a SAS programmer, it would be nice if he for instance could change the days through an Excel file say (or something else that does not require technical/programming skills) ).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I demonstrate by example:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* My Pseudo Program, not detailed but hopefully conveying the main ideas; 

* First I create a variable for todays date; 
data null_;
	Todays_Date = put(today(),date9.);
        call symput("Todays_Date", Todays_Date);
run; 

%If Todays_Date = 2021-06-21 %then %do; 
  %include "Some Random Program that will produce an export file";
%end; 

%If Todays_Date = 2021-06-15 %then %do; 
  %include "Some Random Program &lt;STRONG&gt;2&lt;/STRONG&gt; that will produce an export file";
%end; 

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the question is:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. How can I get this program to for instance run automatically evry day (or evry month for instance) at 14.00?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Now the program runs evry day, and the sales person will conact me for next month and Ask:&lt;EM&gt; "Can you change so that the program "Some Random Program" is ran 2021-07-14 [instead of 2021-06-21] for the uppcoming month"?&lt;/EM&gt; Ideally, the user should be able to change this himself without going into SAS (in reality, the program is far much more complex than the pseudo program demonstrated here).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;All advice appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Jun 2021 08:19:53 GMT</pubDate>
    <dc:creator>SasStatistics</dc:creator>
    <dc:date>2021-06-21T08:19:53Z</dc:date>
    <item>
      <title>Automate Programs to run specific days and the user should be able to change which days to run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749198#M235377</link>
      <description>&lt;P&gt;Assume I have created a program that includes different files to run for different days. I would like this program to run automatically, for instance every day 14.00. Since I have created this program to produce some output (for example creating a customer list) I would like the user (for instance a sales person) to be able to manually change which days he wants to receive this list (since the sales person is not a SAS programmer, it would be nice if he for instance could change the days through an Excel file say (or something else that does not require technical/programming skills) ).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I demonstrate by example:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* My Pseudo Program, not detailed but hopefully conveying the main ideas; 

* First I create a variable for todays date; 
data null_;
	Todays_Date = put(today(),date9.);
        call symput("Todays_Date", Todays_Date);
run; 

%If Todays_Date = 2021-06-21 %then %do; 
  %include "Some Random Program that will produce an export file";
%end; 

%If Todays_Date = 2021-06-15 %then %do; 
  %include "Some Random Program &lt;STRONG&gt;2&lt;/STRONG&gt; that will produce an export file";
%end; 

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So the question is:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. How can I get this program to for instance run automatically evry day (or evry month for instance) at 14.00?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Now the program runs evry day, and the sales person will conact me for next month and Ask:&lt;EM&gt; "Can you change so that the program "Some Random Program" is ran 2021-07-14 [instead of 2021-06-21] for the uppcoming month"?&lt;/EM&gt; Ideally, the user should be able to change this himself without going into SAS (in reality, the program is far much more complex than the pseudo program demonstrated here).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;All advice appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 08:19:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749198#M235377</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-21T08:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Automate Programs to run specific days and the user should be able to change which days to run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749201#M235379</link>
      <description>&lt;P&gt;For everyday scheduling under Linux/UNIX try to use: &lt;A href="https://en.wikipedia.org/wiki/Cron" target="_blank"&gt;https://en.wikipedia.org/wiki/Cron&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If user can put the file somewhere on the network you can use `filename URL` to get it and then extract the date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 08:50:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749201#M235379</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-06-21T08:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Automate Programs to run specific days and the user should be able to change which days to run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749237#M235392</link>
      <description>Linux is used. The user can put the file on the network, can you be more specific about: "you can use `filename URL` to get it and then extract the date."?&lt;BR /&gt;Thanks.</description>
      <pubDate>Mon, 21 Jun 2021 11:33:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749237#M235392</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-06-21T11:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Automate Programs to run specific days and the user should be able to change which days to run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749249#M235402</link>
      <description>&lt;P&gt;Assuming that&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;www.some.address.on.net/file.xlsx&lt;/PRE&gt;
&lt;P&gt;is the location of the excel file (in fact a text file with the date would be even more convenient)&lt;/P&gt;
&lt;P&gt;you can do something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename in URL "www.some.address.on.net/file.xlsx" lrecl=1 recfm=n;
filename out URL "%susfunc(pathname(work))/file.xlsx" lrecl=1 recfm=n;

data _null_;
  rc = fcopy("in","out");
  if rc then put "ERROR!";
run;

filename in clear;
filename out clear;

proc import path = "%susfunc(pathname(work))/file.xlsx";
&amp;lt;...&amp;gt;
run;

&amp;lt;...&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the file would be a text file with just date:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename in URL "www.some.address.on.net/file.txt";

data _null_;
  infile in;
  input date anydatea.;
  call sumputx("date", put(date, yymmdd10.), "G");
run;

filename in clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course you will have to add some "defensive" code, like testing if file exist, testing if date is propper, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the best&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 12:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749249#M235402</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-06-21T12:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Automate Programs to run specific days and the user should be able to change which days to run</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749372#M235468</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;&amp;nbsp; - Scheduling is also available via SAS Management Console. Talk to your SAS administrator to find out more.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 20:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automate-Programs-to-run-specific-days-and-the-user-should-be/m-p/749372#M235468</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-06-21T20:07:15Z</dc:date>
    </item>
  </channel>
</rss>

