<?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: Macro Value for SAS Program Name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21077#M3352</link>
    <description>Thanks for the info, I have already looked at the automatic macro variables by running a %put _all_; and it never returned any value which looked appropriate.&lt;BR /&gt;
&lt;BR /&gt;
I am running PC SAS locally on a windows environment, so I am not running it in a batch process.</description>
    <pubDate>Mon, 20 Apr 2009 15:20:35 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-04-20T15:20:35Z</dc:date>
    <item>
      <title>Macro Value for SAS Program Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21074#M3349</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have been trying to put some code together as as standard macro to be included in all programs which are run.  The code I am pulling together is essentially a complex proc printto with some automated checking built in to identify errors.&lt;BR /&gt;
&lt;BR /&gt;
Is it running in a project environment with standard folder structures, but I was wondering if there is a macro variable which details your program name and/or the directory it is stored in (or a way to get this data).  This would allow me to amend the code so that it would automatically save off without having to populate the macro with a folder and filename.&lt;BR /&gt;
&lt;BR /&gt;
I hope this is clear enough and nay help would be greatly appreciated.</description>
      <pubDate>Mon, 20 Apr 2009 14:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21074#M3349</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-20T14:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Value for SAS Program Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21075#M3350</link>
      <description>You can get this inforrmation in a couple of ways (provided you're running in batch mode).&lt;BR /&gt;
&lt;BR /&gt;
1. Use the SYSPROCESSNAME automatic macro variable&lt;BR /&gt;
2. Use something like: %LET sysin=%SYSFUNC(GETOPTION(sysin));&lt;BR /&gt;
&lt;BR /&gt;
Both of these give you the program name and path.</description>
      <pubDate>Mon, 20 Apr 2009 15:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21075#M3350</guid>
      <dc:creator>LawrenceHW</dc:creator>
      <dc:date>2009-04-20T15:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Value for SAS Program Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21076#M3351</link>
      <description>Check for SAS Auto System Variables.&lt;BR /&gt;
&lt;BR /&gt;
see: &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a003167023.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a003167023.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
You might want to look into the &amp;amp;SYSPROCESSNAME Var&lt;BR /&gt;
&lt;BR /&gt;
see: &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001221839.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001221839.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Greeting from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos at &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Mon, 20 Apr 2009 15:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21076#M3351</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-04-20T15:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Value for SAS Program Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21077#M3352</link>
      <description>Thanks for the info, I have already looked at the automatic macro variables by running a %put _all_; and it never returned any value which looked appropriate.&lt;BR /&gt;
&lt;BR /&gt;
I am running PC SAS locally on a windows environment, so I am not running it in a batch process.</description>
      <pubDate>Mon, 20 Apr 2009 15:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21077#M3352</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-20T15:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Value for SAS Program Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21078#M3353</link>
      <description>See: &lt;A href="http://support.sas.com/kb/8/707.html" target="_blank"&gt;http://support.sas.com/kb/8/707.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
This may help, but there are other issues with interactive submits this may not help with.</description>
      <pubDate>Mon, 20 Apr 2009 15:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21078#M3353</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-04-20T15:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Value for SAS Program Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21079#M3354</link>
      <description>Lawrence is correct.  You can get this with &amp;amp;sysprocessname though if you want just the program name you need to clean it up a bit, e.g. the following is saved in a file named "mytestprogram.sas"...&lt;BR /&gt;
&lt;BR /&gt;
1          %put &amp;amp;sysprocessname;&lt;BR /&gt;
Program mytestprogram.sas&lt;BR /&gt;
2          &lt;BR /&gt;
3          %let progname=%scan(&amp;amp;sysprocessname,2,%str( ));&lt;BR /&gt;
4          &lt;BR /&gt;
5          %put &amp;amp;progname;&lt;BR /&gt;
mytestprogram.sas&lt;BR /&gt;
6&lt;BR /&gt;
&lt;BR /&gt;
Note that when using the %scan() you must specify to use only a blank as a delimiter, and for this to work it must be enclosed within a %str( ).</description>
      <pubDate>Wed, 22 Apr 2009 13:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21079#M3354</guid>
      <dc:creator>PatrickG</dc:creator>
      <dc:date>2009-04-22T13:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Value for SAS Program Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21080#M3355</link>
      <description>OK Ian, no batch, then SYSPROCESSNAME is useless.&lt;BR /&gt;
If your running in a interactive session, try looking into the DICTIONARY.EXTFILES table, that lists all external files opened in your session (including your scripts).&lt;BR /&gt;
Your script should be listed there, you only have to find a logical manner to pick the right entry.&lt;BR /&gt;
&lt;BR /&gt;
_data null_'s tip seems also a good solution, you should give it a try.&lt;BR /&gt;
&lt;BR /&gt;
Greetings from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos at &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Thanks for the info, I have already looked at the&lt;BR /&gt;
&amp;gt; automatic macro variables by running a %put _all_;&lt;BR /&gt;
&amp;gt; and it never returned any value which looked&lt;BR /&gt;
&amp;gt; appropriate.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I am running PC SAS locally on a windows environment,&lt;BR /&gt;
&amp;gt; so I am not running it in a batch process.</description>
      <pubDate>Thu, 23 Apr 2009 20:45:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21080#M3355</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-04-23T20:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Value for SAS Program Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21081#M3356</link>
      <description>Iain&lt;BR /&gt;
 &lt;BR /&gt;
you're building a significant challenge, attempting to trap the names of "programs which are run". In the ad-hoc job submission worlds I have seen, the included program is often updated before it is "run", and in some cases the standard operating practises recommend &lt;I&gt; not  saving&lt;/I&gt;.&lt;BR /&gt;
You may find a convenient trap available when code is submitted. Function keys and toolbar icons can be adapted to preform the trap you need. &lt;BR /&gt;
You refer to proc printto. Have you recognised the potential of the alternative ALTLOG/ALTPRINT options? These leave your normal log and listing but send an additional copy to a file. Dynamically, you can identify and work with that file (but beware file locks which only a few applications like notepad.exe will ignore).&lt;BR /&gt;
What would you want to do with the errors in a log which results from code which has not been saved and was created from new? No SAS feature can provide a name, because no name has been associated with that program!&lt;BR /&gt;
 &lt;BR /&gt;
good luck&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Tue, 28 Apr 2009 08:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21081#M3356</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-04-28T08:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Value for SAS Program Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21082#M3357</link>
      <description>The following SAS Usage note might also be helpful.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/24/301.html" target="_blank"&gt;http://support.sas.com/kb/24/301.html&lt;/A&gt;</description>
      <pubDate>Wed, 29 Apr 2009 17:09:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Value-for-SAS-Program-Name/m-p/21082#M3357</guid>
      <dc:creator>Russ_SAS</dc:creator>
      <dc:date>2009-04-29T17:09:05Z</dc:date>
    </item>
  </channel>
</rss>

