<?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: Main sas program for several sas programs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863682#M341148</link>
    <description>&lt;P&gt;Are you running SAS on Unix or Windows? (or IBM mainframe?)&lt;/P&gt;
&lt;P&gt;Are you trying to run all of the programs in a single SAS session?&lt;/P&gt;
&lt;P&gt;Or do you want to run them completely independently of each other?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The last is the best as then you don't have to play games with re-directing the log or worry about mistakes in one program putting SAS into strange state or programs only working because of side effects level over from the previous program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you probably just want to create an operating system command file to run the commands.&lt;/P&gt;
&lt;P&gt;So on Unix it would look something like:&lt;/P&gt;
&lt;PRE&gt;cd /..../Folder_1
sas 1_Test.sas
grep ^ERROR.*: 1_Test.log
sas 2_PGM.sas
grep ^ERROR.*: 2_PGM.log
cd /.../Folder_2
...
&lt;/PRE&gt;</description>
    <pubDate>Sun, 12 Mar 2023 18:26:40 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-03-12T18:26:40Z</dc:date>
    <item>
      <title>Main sas program for several sas programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863680#M341147</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear expert,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Having a several sas programs ordred as Follow :&lt;/P&gt;
&lt;P&gt;Folder_1/1_Test.sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /2_PGM.sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Folder_2/1_PGM.sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /2_PM.sas&lt;/P&gt;
&lt;P&gt;I want to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Create a main program for all sas program like this( the program order is important):&lt;/P&gt;
&lt;P&gt;%include /Dir/Dir1/ Folder_1/1_Test.sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) create a log file for every program&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) analyze the files log in order to find: ERROR, Warning, _ORROR_&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2023 18:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863680#M341147</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2023-03-12T18:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Main sas program for several sas programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863682#M341148</link>
      <description>&lt;P&gt;Are you running SAS on Unix or Windows? (or IBM mainframe?)&lt;/P&gt;
&lt;P&gt;Are you trying to run all of the programs in a single SAS session?&lt;/P&gt;
&lt;P&gt;Or do you want to run them completely independently of each other?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The last is the best as then you don't have to play games with re-directing the log or worry about mistakes in one program putting SAS into strange state or programs only working because of side effects level over from the previous program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you probably just want to create an operating system command file to run the commands.&lt;/P&gt;
&lt;P&gt;So on Unix it would look something like:&lt;/P&gt;
&lt;PRE&gt;cd /..../Folder_1
sas 1_Test.sas
grep ^ERROR.*: 1_Test.log
sas 2_PGM.sas
grep ^ERROR.*: 2_PGM.log
cd /.../Folder_2
...
&lt;/PRE&gt;</description>
      <pubDate>Sun, 12 Mar 2023 18:26:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863682#M341148</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-12T18:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Main sas program for several sas programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863689#M341149</link>
      <description>&lt;P&gt;Thank you very much.&lt;BR /&gt;It will run for all Operating System (not only unix) and in one sas session.&lt;BR /&gt;I want some thing automatic, linkg to all sas programs, keeping the programs order, create a log files and analysis the error and warning by program&lt;/P&gt;</description>
      <pubDate>Sun, 12 Mar 2023 20:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863689#M341149</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2023-03-12T20:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Main sas program for several sas programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863705#M341153</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44053"&gt;@LineMoon&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;While the overall logic will be same (as given by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; ) irrespective of the operating system, the actual implementation / scripting will be different.&lt;BR /&gt;If you want to use an OS independent solution then better to write a SAS program to serve the purpose.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 00:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863705#M341153</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2023-03-13T00:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Main sas program for several sas programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863746#M341164</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44053"&gt;@LineMoon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you very much.&lt;BR /&gt;It will run for all Operating System (not only unix) and in one sas session.&lt;BR /&gt;I want some thing automatic, linkg to all sas programs, keeping the programs order, create a log files and analysis the error and warning by program&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As I said that will introduce a lot more complications.&amp;nbsp; Once you have run one of the programs the others can never be sure what state SAS is in when they start.&amp;nbsp; So your system will be more fragile and require more complications.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you just want to run all of the programs in one SAS job you could do something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename dir1 '/..../Folder_1';
%include dir1('*.sas') / source2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are saying you want to write the part of the SAS log generated by each file to separate locations that will require a lot more work.&amp;nbsp; You either have to have a dataset with the list of program files, or use code to generate the list by reading the directory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So say you created a dataset name FILES with a variable named PROGRAM you might use that to generate code like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp;
data _null_;
  set files ;
  file code;
  log=program;
  log=tranwrd(log,'.sas','.log');
  put 'proc printto log=' log :$quote. ';run;'
    / '%include ' program :$quote. ';'
    / 'proc printto log=log; run;'
  ;
run;
%include code / source2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Mar 2023 05:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863746#M341164</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-13T05:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Main sas program for several sas programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863749#M341166</link>
      <description>&lt;P&gt;So your company/institution runs multiple SAS servers on multiple different operating systems (also implying multiple SAS licenses)? This is quite unique.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 06:49:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/863749#M341166</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-13T06:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Main sas program for several sas programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/866245#M342089</link>
      <description>Thank you very much</description>
      <pubDate>Fri, 24 Mar 2023 22:38:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/866245#M342089</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2023-03-24T22:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Main sas program for several sas programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/866247#M342090</link>
      <description>In this case, I can use sas with the unix commands</description>
      <pubDate>Fri, 24 Mar 2023 22:39:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/866247#M342090</guid>
      <dc:creator>LineMoon</dc:creator>
      <dc:date>2023-03-24T22:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: Main sas program for several sas programs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/866270#M342098</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44053"&gt;@LineMoon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you very much.&lt;BR /&gt;It will run for all Operating System (not only unix) and in one sas session.&lt;BR /&gt;I want some thing automatic, linkg to all sas programs, keeping the programs order, create a log files and analysis the error and warning by program&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is called&amp;nbsp;&lt;EM&gt;scheduling&lt;/EM&gt;. Your company/institution will already have such in place; consult the admins how to integrate your SAS programs there.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Mar 2023 08:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Main-sas-program-for-several-sas-programs/m-p/866270#M342098</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-25T08:34:16Z</dc:date>
    </item>
  </channel>
</rss>

