<?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: Sas Change fucntion and the SYSERR macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-Change-fucntion-and-the-SYSERR-macro-variable/m-p/83592#M18042</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrapped my macro call in a program and used %include program-name in placeof the call to the macro. &lt;/P&gt;&lt;P&gt;So for the above code I now have a program called Prog_ChangeFileName. With the code to run the macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC DATASETS Library=&amp;amp;DataLibrary;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %ChangeFileName;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I run the program and then check the syserr in a seperate macro called %chkerr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%INCLUDE automation_run_change_file_name;&lt;/P&gt;&lt;P&gt;%chkerr;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This has fixed my issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jan 2013 13:50:58 GMT</pubDate>
    <dc:creator>AndrewOS</dc:creator>
    <dc:date>2013-01-24T13:50:58Z</dc:date>
    <item>
      <title>Sas Change fucntion and the SYSERR macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Change-fucntion-and-the-SYSERR-macro-variable/m-p/83590#M18040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am changing the names of sasdata sets in a sas macro. When the new dataset name already exists the program writes an error message to my log. Which is correct. However I am trying to catch this error within the program using the &amp;amp;SYSERR variable. But this is always 0 after the change statment has been executed. Does running the change statment from within a macro effect the value of the &amp;amp;SYSERR variable. Is there another variable that I could use as this would be very handy for error checking. Code is below.&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;BR /&gt;%macro ChangeFileName;&lt;BR /&gt; &lt;BR /&gt; /*&amp;nbsp; Change the file name of the existing files. The new file name is built using &lt;BR /&gt;&amp;nbsp; Shared Datasets.File_Names.Archive_File_Name and the postfix returned by the %SetMMYY macro */&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&amp;nbsp; %PUT "------- Change File Names------";&lt;BR /&gt;&amp;nbsp; %DO i=1 %TO &amp;amp;Bkup_NumObs;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %LET FileName =&amp;nbsp; %SYSFUNC(CAT(&amp;amp;Bkup_File_Name,&amp;amp;i));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %LET FileNameMMYY&amp;nbsp; = %SYSFUNC(CAT(&amp;amp;Bkup_File_Name_MMYY,&amp;amp;i));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %LET FileNameMMYY = &amp;amp;FileNameMMYY.&amp;amp;MMYY; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; %LET Nm = %SYSFUNC(CAT(&amp;amp;DataLibrary,.,&amp;amp;FileName));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %PUT &amp;amp;Nm;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&amp;nbsp;&amp;nbsp; %IF %SYSFUNC(exist(%UPCASE(&amp;amp;Nm))) %THEN %DO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %PUT Change &amp;amp;FileName to &amp;amp;FileNameMMYY;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CHANGE &amp;amp;FileName= &amp;amp;FileNameMMYY;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %PUT &amp;amp;syserr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %END;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %ELSE %DO; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %PUT ******* &amp;amp;DataLibrary.&amp;amp;FileName does not exists. *******;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %END;&lt;BR /&gt;&amp;nbsp; %END;&lt;BR /&gt;&amp;nbsp; run;&lt;BR /&gt;%mend&amp;nbsp; &lt;BR /&gt;ChangeFileName;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 16:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Change-fucntion-and-the-SYSERR-macro-variable/m-p/83590#M18040</guid>
      <dc:creator>AndrewOS</dc:creator>
      <dc:date>2013-01-23T16:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Change fucntion and the SYSERR macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Change-fucntion-and-the-SYSERR-macro-variable/m-p/83591#M18041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can check for the existence of the data set with the following where &amp;amp;dsn resolves to your data set name.&lt;/P&gt;&lt;P&gt;%if %sysfunc(exist(&amp;amp;dsn)) %then&amp;nbsp;&amp;nbsp; %do (etc)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Probably putting your Change within another %else&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 18:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Change-fucntion-and-the-SYSERR-macro-variable/m-p/83591#M18041</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-01-23T18:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Change fucntion and the SYSERR macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-Change-fucntion-and-the-SYSERR-macro-variable/m-p/83592#M18042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrapped my macro call in a program and used %include program-name in placeof the call to the macro. &lt;/P&gt;&lt;P&gt;So for the above code I now have a program called Prog_ChangeFileName. With the code to run the macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC DATASETS Library=&amp;amp;DataLibrary;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %ChangeFileName;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I run the program and then check the syserr in a seperate macro called %chkerr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%INCLUDE automation_run_change_file_name;&lt;/P&gt;&lt;P&gt;%chkerr;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This has fixed my issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 13:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-Change-fucntion-and-the-SYSERR-macro-variable/m-p/83592#M18042</guid>
      <dc:creator>AndrewOS</dc:creator>
      <dc:date>2013-01-24T13:50:58Z</dc:date>
    </item>
  </channel>
</rss>

