<?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 %sysget in batch mode in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947306#M42542</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please pardon me if this question is too silly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I could run following code in interactive mode but got following warning in batch mode. Why? How can I run this in batch mode?&lt;/P&gt;
&lt;PRE&gt; %let _source=%sysget(sas_execfilepath);

WARNING: The argument to macro function %SYSGET is not defined as a system variable.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Oct 2024 02:30:12 GMT</pubDate>
    <dc:creator>stataq</dc:creator>
    <dc:date>2024-10-14T02:30:12Z</dc:date>
    <item>
      <title>%sysget in batch mode</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947306#M42542</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please pardon me if this question is too silly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I could run following code in interactive mode but got following warning in batch mode. Why? How can I run this in batch mode?&lt;/P&gt;
&lt;PRE&gt; %let _source=%sysget(sas_execfilepath);

WARNING: The argument to macro function %SYSGET is not defined as a system variable.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 02:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947306#M42542</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-10-14T02:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: %sysget in batch mode</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947308#M42543</link>
      <description>&lt;P&gt;You need set a parameter in batch file for it.Like:&lt;/P&gt;
&lt;PRE&gt;"D:\SASHome\SASFoundation\9.4\sas.exe" -nosplash -sysin "c:\temp\temp.sas"  -set sas_execfilepath "c:\temp\temp.sas"&lt;/PRE&gt;
&lt;P&gt;Or try GETOPTION() function:&lt;/P&gt;
&lt;PRE&gt;%let path=%sysfunc(getoption(sysin));
%put &amp;amp;path.;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 02:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947308#M42543</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-10-14T02:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: %sysget in batch mode</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947309#M42544</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;Could you further explain the part on "&lt;SPAN&gt;set a parameter in batch file"? &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also tried "&lt;SPAN&gt;GETOPTION()". In my system, it get path in patch mode but not interactive mode.&amp;nbsp; Is it normal?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is there a way to get path in both methods?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 03:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947309#M42544</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-10-14T03:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: %sysget in batch mode</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947311#M42545</link>
      <description>&lt;P&gt;sas_execfilepath is an environment variable set and updated when you're using "PC SAS".&lt;/P&gt;
&lt;P&gt;If you're running in batch mode then SAS can't know in advance what program you want to run and though won't create this environment variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The -set option in the batch command&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;shared lets you define and populate an environment variable that you then can query within your program. This then allows you to execute the exactly same code in batch.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively you can also query the value of SYSIN as it will also contain the path to the .sas file you're executing in batch.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 03:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947311#M42545</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-10-14T03:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: %sysget in batch mode</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947315#M42546</link>
      <description>"I also tried "GETOPTION()". In my system, it get path in patch mode but not interactive mode.  Is it normal?"&lt;BR /&gt;Yes. It is normal.&lt;BR /&gt;&lt;BR /&gt;"Is there a way to get path in both methods? "&lt;BR /&gt;Did you check my code ?&lt;BR /&gt; -set sas_execfilepath &lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; wrote a blog about this before. Check:&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/03/16/pass-params-sysget.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2015/03/16/pass-params-sysget.html&lt;/A&gt;</description>
      <pubDate>Mon, 14 Oct 2024 03:40:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947315#M42546</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-10-14T03:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: %sysget in batch mode</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947317#M42547</link>
      <description>&lt;P&gt;You will get that warning if you are not running interactively on Windows since that environment variable is only set by PC-SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example here is what I get when running interactive Display Manager on Unix.&lt;/P&gt;
&lt;PRE&gt;WARNING: The argument to macro function %SYSGET is not defined as a system variable.
1    %put %sysget(sas_execfilepath);

2    %put %sysfunc(getoption(dms));
DMS
3    %put &amp;amp;=sysscp;
SYSSCP=LIN X64&lt;/PRE&gt;
&lt;P&gt;If you are running from the command line (what some call "batch" mode even when there are no batch queues involved) then you probably want to get the value of the SYSIN option instead if the goal is to check what SAS program is being run.&lt;/P&gt;
&lt;P&gt;Put this code into your program instead:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let _source=%sysfunc(getoption(sysin));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Oct 2024 04:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947317#M42547</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-14T04:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: %sysget in batch mode</title>
      <link>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947371#M42553</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp; Thanks so much for the kindly explanations. I am learning SAS for about 1 year, I was told that I should make all my programs batch runnable. Is it true that is how sas program should be?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I normally develop my codes in interactive mode, and stuck when I tried to run them in batch mode. Any suggestion on how to make interactive mode code runnable in batch mode? what kind of modification I should do normally?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 12:18:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/sysget-in-batch-mode/m-p/947371#M42553</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-10-14T12:18:33Z</dc:date>
    </item>
  </channel>
</rss>

