<?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: Find Path of SAS program in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852274#M336913</link>
    <description>&lt;P&gt;I'm confused.&amp;nbsp; Looks like your code is running on linux SAS.&amp;nbsp; What client are you using to submit code? (EG, studio, etc)?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is program1.sas stored?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is program2.sas stored?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you saying you know that program1.sas and program2.sas are stored in the same directory, but you don't want to hard-code the path?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a standard directory structure that stores your code for each project, one option is to make a macro var with the path to the code directory, e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let CodeDir= /home/mystuff/ProjectFoo/Code ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you hard code the directory one place, but then can use the macro variable in filename statement, include statement, etc.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can often avoid hard-coding completely, but the solution depends on your client, and the setup of your file structures.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jan 2023 13:32:59 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2023-01-05T13:32:59Z</dc:date>
    <item>
      <title>Find Path of SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852238#M336898</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Let's say that I have 2 SAS programs: "Program1",&amp;nbsp; "Program2".&lt;/P&gt;
&lt;P&gt;Let's say that within the code of "Program1" I want to write a command (statement) to run "Program2"&lt;/P&gt;
&lt;P&gt;It means that When "program1" is running then "Program2" will run two and I don't need to open "program2" in order to run it.&lt;/P&gt;
&lt;P&gt;For that task I need to write include statement as following:&lt;/P&gt;
&lt;P&gt;%include "/path/program.sas";&lt;/P&gt;
&lt;P&gt;The problem that I don't know the path of "Program2"&lt;/P&gt;
&lt;P&gt;I wrote&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let rc = %sysfunc(filename(fr,.));
%let curdir = %sysfunc(pathname(&amp;amp;fr));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and got&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/usr/local/SAS/Config/Lev1/LabRet&lt;/PRE&gt;
&lt;P&gt;Then I tried&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include "/usr/local/SAS/Config/Lev1/LabRet/program1.SAS";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and got error&lt;/P&gt;
&lt;PRE&gt;WARNING: Physical file does not exist, /usr/local/SAS/Config/Lev1/LabRet/program1.SAS.
ERROR: Cannot open %INCLUDE file /usr/local/SAS/Config/Lev1/LabRet/program1.SAS.
&lt;/PRE&gt;
&lt;P&gt;My question:&lt;/P&gt;
&lt;P&gt;How can I find the correct path to my sas program?&lt;/P&gt;
&lt;P&gt;Please&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 07:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852238#M336898</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-01-05T07:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Find Path of SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852239#M336899</link>
      <description>&lt;P&gt;Depends on the application used to execute code. Run %put _all_; to get all macro-variable, in SAS Studio and Display Manager there should be a variable named "_SASPROGRAMFILE" pointing to the path of the current program. Using string function to extract the path shouldn't be difficult. In EG 8.3 I see that variable, too.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 07:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852239#M336899</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-01-05T07:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Find Path of SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852257#M336907</link>
      <description>&lt;P&gt;Why don't you know where your programs are stored? Are you eventually trying to include code that only exists in your client side EG/Studio project but not on the file system as a file?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 12:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852257#M336907</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-01-05T12:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Find Path of SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852274#M336913</link>
      <description>&lt;P&gt;I'm confused.&amp;nbsp; Looks like your code is running on linux SAS.&amp;nbsp; What client are you using to submit code? (EG, studio, etc)?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is program1.sas stored?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is program2.sas stored?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you saying you know that program1.sas and program2.sas are stored in the same directory, but you don't want to hard-code the path?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a standard directory structure that stores your code for each project, one option is to make a macro var with the path to the code directory, e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let CodeDir= /home/mystuff/ProjectFoo/Code ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you hard code the directory one place, but then can use the macro variable in filename statement, include statement, etc.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can often avoid hard-coding completely, but the solution depends on your client, and the setup of your file structures.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 13:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852274#M336913</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-01-05T13:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Find Path of SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852298#M336926</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt; open %INCLUDE file /usr/local/SAS/Config/Lev1/LabRet/program1.SAS.
&lt;/PRE&gt;
&lt;P&gt;My question:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;How can I find the correct path to my sas program?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Please&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm guessing your &lt;A href="https://support.dtsearch.com/webhelp/dtsearch/Relative_Paths.htm" target="_self"&gt;path is relative&lt;/A&gt; and in the same folder as program 1? Or is it a level above, below? You have to know where it should be relative to the running program or know the absolute path to reference it.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 16:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-Path-of-SAS-program/m-p/852298#M336926</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-01-05T16:22:20Z</dc:date>
    </item>
  </channel>
</rss>

