<?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: autoexec code does not always run. Problem solved. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/765313#M242403</link>
    <description>My autoexec included an ODS reset macro that included the command ods _ALL_&lt;BR /&gt;close. I needed to follow it with an ods listing command. It affected&lt;BR /&gt;output within the autoexec itself. Interestingly, when I ran code in new&lt;BR /&gt;programs the ods listing command seemed to take effect automatically and&lt;BR /&gt;output listings appear as normal.&lt;BR /&gt;</description>
    <pubDate>Wed, 01 Sep 2021 12:01:11 GMT</pubDate>
    <dc:creator>MaryA_Marion</dc:creator>
    <dc:date>2021-09-01T12:01:11Z</dc:date>
    <item>
      <title>autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/762729#M241517</link>
      <description>&lt;P&gt;The following code runs by itself correctly but when put at end of an autoexec gives no errors and no output. What is wrong with it?&lt;/P&gt;
&lt;P&gt;Does an autoexec need special code at end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data timetrak; time1=time(); date=date(); run;                    
data timetrak; set timetrak; file print;
put "STAT 755 Clinical Trials" // 
    "Today's date is " date mmddyy8.  " and the time is" time1 hhmm6. // 
    "Author: Mary A. Marion" /; 
run; quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Thank you. MM&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 02:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/762729#M241517</guid>
      <dc:creator>MaryA_Marion</dc:creator>
      <dc:date>2021-08-20T02:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/762731#M241518</link>
      <description>&lt;P&gt;Do you get a warning that no ODS destination is active?&lt;/P&gt;
&lt;P&gt;Where do you expect the text to appear?&lt;/P&gt;
&lt;P&gt;Do you see that the code has been run?&lt;/P&gt;
&lt;P&gt;Note that your code can be written as:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  TIME=time(); 
  DATE=date(); 
  file print;
  put "STAT 755 Clinical Trials" // 
      "Today's date is " DATE mmddyy8. " and the time is" TIME hhmm6. // 
      "Author: Mary A. Marion" /; 
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Aug 2021 02:16:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/762731#M241518</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-20T02:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/762747#M241521</link>
      <description>What do you mean by "always run"? Do you expect it to run each time you submit code? Or each time you start SAS?</description>
      <pubDate>Fri, 20 Aug 2021 03:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/762747#M241521</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-08-20T03:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/762752#M241526</link>
      <description>&lt;P&gt;Does the data set Timetrak exist in the Work library when this code "doesn't run"? If the set is there likely you have something very interesting going on and a Log entry from when it does not run will be needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: you can simplify that to&lt;/P&gt;
&lt;PRE&gt;data timetrak; 
   time1=time(); 
   date=date();                   
   file print;
   put "STAT 755 Clinical Trials" // 
    "Today's date is " date mmddyy8.  " and the time is" time1 hhmm6. // 
    "Author: Mary A. Marion" /; 
run; &lt;/PRE&gt;
&lt;P&gt;and if you don't actually need to use the data set Timetrak for anything else you can use Data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FWIW, I have had a somewhat similar data step in my Autoexec for more than 8 years and several versions of SAS that displays a countdown to a given date. I have never had it not run or fail to display the result.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 05:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/762752#M241526</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-20T05:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763073#M241642</link>
      <description>&lt;DIV class="gmail_default"&gt;Thank you for your reply.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;In lieu of doing&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;a lot more extra work on this,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I tried moving&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;the TimeTrak&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;code&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to its original location at the top&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of the autoexec.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;It's working fine again.&amp;nbsp;Before I was ending up at the output data window.&amp;nbsp;It appears I need some sort of closing code to take it back to the results window.&lt;BR /&gt;&lt;BR /&gt;To get around this entire problem I created another macro called timetrak1&amp;nbsp;which I put at the top of working developing programs. It gives me a title line which I can change for different tasks.&lt;/DIV&gt;
&lt;DIV class="gmail_default"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="gmail_default"&gt;This&amp;nbsp;solves the problem well enough for me to proceed. Thanks for the help.&lt;/DIV&gt;
&lt;DIV class="gmail_default"&gt;MM&lt;/DIV&gt;
&lt;DIV class="gmail_default"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sat, 21 Aug 2021 19:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763073#M241642</guid>
      <dc:creator>MaryA_Marion</dc:creator>
      <dc:date>2021-08-21T19:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763077#M241643</link>
      <description>&lt;P&gt;I am not sure about the work directory. I will watch for that. I just tried an old version that ran and TimeTrak was in the work library so right now I think it best I just stay with what I have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been wanting to save my graphs and am including the following code in my AUTOEXEC.&amp;nbsp; It appears before the TimeTrak code when TimeTrak is at the end of the AUTOEXEC. That is a little suspicious. It may be affecting the work library?&amp;nbsp;Can you give me a better way to refer to the SAS work location?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;106 *ODS GRAPHICS;
107 %let
107 ! sasworklocation="/saswork/SAS_workB81000013419_odaws01-usw2.oda.sas.
107 ! com/SAS_workDB5300013419_odaws01-usw2.oda.sas.com";
108 ods listing gpath=&amp;amp;sasworklocation;
SYMBOLGEN: Macro variable SASWORKLOCATION resolves to
"/saswork/SAS_workB81000013419_odaws01-usw2.oda.sas.com/SAS_workDB5
300013419_odaws01-usw2.oda.sas.com"
109&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Could that be causing some of the difficulty here?&amp;nbsp;I had SAS&amp;nbsp;studio give me the location which is how I got this long set of instructions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Aug 2021 20:19:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763077#M241643</guid>
      <dc:creator>MaryA_Marion</dc:creator>
      <dc:date>2021-08-21T20:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763078#M241644</link>
      <description>I expected the autoexec to run each time I submit code. I leave it as a file in my home directory. I'm modifying it so often as I improve my skills that it just seems to be the best place to put it.</description>
      <pubDate>Sat, 21 Aug 2021 19:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763078#M241644</guid>
      <dc:creator>MaryA_Marion</dc:creator>
      <dc:date>2021-08-21T19:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763079#M241645</link>
      <description>&lt;P&gt;No warnings about the ODS destination.&lt;BR /&gt;I do have the following lines of code in the AUTOEXEC. I wasn't sure how to refer to the SAS work library. The following is not giving an error however.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;106 *ODS GRAPHICS;&lt;BR /&gt;107 %let&lt;BR /&gt;107 ! sasworklocation="/saswork/SAS_workB81000013419_odaws01-usw2.oda.sas.&lt;BR /&gt;107 ! com/SAS_workDB5300013419_odaws01-usw2.oda.sas.com";&lt;BR /&gt;108 ods listing gpath=&amp;amp;sasworklocation;&lt;BR /&gt;SYMBOLGEN: Macro variable SASWORKLOCATION resolves to&lt;BR /&gt;"/saswork/SAS_workB81000013419_odaws01-usw2.oda.sas.com/SAS_workDB5&lt;BR /&gt;300013419_odaws01-usw2.oda.sas.com"&lt;BR /&gt;109&lt;BR /&gt;110 *EMF FILE CREATION IN SAS 9.4;&lt;BR /&gt;111 %let workdir=%trim(%sysfunc(pathname(work)));&lt;BR /&gt;MLOGIC(TRIM): Beginning execution.&lt;BR /&gt;MLOGIC(TRIM): This macro was compiled from the autocall file&lt;BR /&gt;/pbr/sfw/sas/940/SASFoundation/9.4/sasautos/trim.sas&lt;BR /&gt;MLOGIC(TRIM): Parameter VALUE has value&lt;BR /&gt;/saswork/SAS_work0B880000230E_odaws03-usw2.oda.sas.com/SAS_work2C9D000023&lt;BR /&gt;0E_odaws03-usw2.oda.sas.com&lt;BR /&gt;MLOGIC(TRIM): %LOCAL I&lt;BR /&gt;SYMBOLGEN: Macro variable VALUE resolves to&lt;BR /&gt;/saswork/SAS_work0B880000230E_odaws03-usw2.oda.sas.com/SAS_work2C9D&lt;BR /&gt;0000230E_odaws03-usw2.oda.sas.com&lt;BR /&gt;MLOGIC(TRIM): %DO loop beginning; index variable I; start value is 100; stop&lt;BR /&gt;value is 1; by value is -1.&lt;BR /&gt;SYMBOLGEN: Macro variable VALUE resolves to&lt;BR /&gt;/saswork/SAS_work0B880000230E_odaws03-usw2.oda.sas.com/SAS_work2C9D&lt;BR /&gt;0000230E_odaws03-usw2.oda.sas.com&lt;BR /&gt;SYMBOLGEN: Macro variable I resolves to 100&lt;BR /&gt;MLOGIC(TRIM): %IF condition %qsubstr(&amp;amp;value,&amp;amp;i,1) ne is TRUE&lt;BR /&gt;MLOGIC(TRIM): %GOTO TRIMMED (label resolves to TRIMMED).&lt;BR /&gt;SYMBOLGEN: Macro variable I resolves to 100&lt;BR /&gt;MLOGIC(TRIM): %IF condition &amp;amp;i&amp;gt;0 is TRUE&lt;BR /&gt;SYMBOLGEN: Macro variable VALUE resolves to&lt;BR /&gt;/saswork/SAS_work0B880000230E_odaws03-usw2.oda.sas.com/SAS_work2C9D&lt;BR /&gt;0000230E_odaws03-usw2.oda.sas.com&lt;BR /&gt;SYMBOLGEN: Macro variable I resolves to 100&lt;BR /&gt;MLOGIC(TRIM): Ending execution.&lt;BR /&gt;112 data _null_;&lt;BR /&gt;SYMBOLGEN: Macro variable WORKDIR resolves to&lt;BR /&gt;/saswork/SAS_work0B880000230E_odaws03-usw2.oda.sas.com/SAS_work2C9D&lt;BR /&gt;0000230E_odaws03-usw2.oda.sas.com&lt;BR /&gt;113 file "&amp;amp;workdir./emf94.sasxreg";&lt;BR /&gt;114 put '[CORE\PRINTING\PRINTERS\EMF\ADVANCED]';&lt;BR /&gt;115 put '"Description"="Enhanced Metafile Format"';&lt;BR /&gt;116 put '"Metafile Type"="EMF"';&lt;BR /&gt;117 put '"Vector Alpha"=int:0';&lt;BR /&gt;118 put '"Image 32"=int:1';&lt;BR /&gt;119 run;&lt;BR /&gt;NOTE: The file&lt;BR /&gt;"/saswork/SAS_ ...

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This may be the problem. How to refer to SAS work location?&lt;/P&gt;</description>
      <pubDate>Sat, 21 Aug 2021 20:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763079#M241645</guid>
      <dc:creator>MaryA_Marion</dc:creator>
      <dc:date>2021-08-21T20:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763081#M241646</link>
      <description>&lt;P&gt;A young colleague of mine had a problem where the AUTOEXEC would sometimes not execute.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After watching her open SAS and do some work, it was obvious what the problem was.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When she double-clicked on the SAS icon on her desktop (which was customized to use a specific autoexec), everything was fine, the autoexec ran. But sometimes she opened SAS by (in Windows) double-clicking on a program file (a *.sas file), and this used the default AUTOEXEC and the custom autoexec did not execute.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Aug 2021 20:13:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/763081#M241646</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-21T20:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/765309#M242399</link>
      <description>&lt;P&gt;Thank you for the reply. I finally figured out the problem. I had included a reset of ODS options in my code&amp;nbsp;that included an ods _ALL_ close command. I needed to add an ODS listing command at the end&amp;nbsp;and voilà everything runs just fine.&amp;nbsp;Now I'm beginning to wonder what causes the listing command to change?&amp;nbsp;It appears to happen when I simply run a new program outside of the autoexec. Interesting.&lt;/P&gt;
&lt;PRE&gt;*ODS STATEMENTS RESET;
options mrecall;
%macro odsReset;
ods path reset;
ods _ALL_ close;
ods trace on;
ods noptitle;
ods graphics on;
ods listing;
%mend odsReset;
%odsReset;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 11:45:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/765309#M242399</guid>
      <dc:creator>MaryA_Marion</dc:creator>
      <dc:date>2021-09-01T11:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run. Problem solved.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/765313#M242403</link>
      <description>My autoexec included an ODS reset macro that included the command ods _ALL_&lt;BR /&gt;close. I needed to follow it with an ods listing command. It affected&lt;BR /&gt;output within the autoexec itself. Interestingly, when I ran code in new&lt;BR /&gt;programs the ods listing command seemed to take effect automatically and&lt;BR /&gt;output listings appear as normal.&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Sep 2021 12:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/765313#M242403</guid>
      <dc:creator>MaryA_Marion</dc:creator>
      <dc:date>2021-09-01T12:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: autoexec code does not always run.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/765398#M242446</link>
      <description>It looks like you may be using SAS Studio? If so, they have some code that runs at each submission as well. You can check the settings so that you can see the wrapper code  - I think it's turned off by default but it's why your log numbers start at some weird number even in a new session.</description>
      <pubDate>Wed, 01 Sep 2021 15:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/autoexec-code-does-not-always-run/m-p/765398#M242446</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-09-01T15:27:07Z</dc:date>
    </item>
  </channel>
</rss>

