<?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 cannot use ../ in the linux sas pipe in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594068#M170610</link>
    <description>suppose i have folder new and a subfolder new1 within it. i have 3 txt files in folder new. my program is in new1. i want to get the file name of 3 text files. the code is filename aa pipe "ls ../*.txt". but the log show no such files. but when run the ls command in the terminal, it show all 3 file name. why?</description>
    <pubDate>Fri, 04 Oct 2019 11:30:36 GMT</pubDate>
    <dc:creator>fanfanpao</dc:creator>
    <dc:date>2019-10-04T11:30:36Z</dc:date>
    <item>
      <title>cannot use ../ in the linux sas pipe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594068#M170610</link>
      <description>suppose i have folder new and a subfolder new1 within it. i have 3 txt files in folder new. my program is in new1. i want to get the file name of 3 text files. the code is filename aa pipe "ls ../*.txt". but the log show no such files. but when run the ls command in the terminal, it show all 3 file name. why?</description>
      <pubDate>Fri, 04 Oct 2019 11:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594068#M170610</guid>
      <dc:creator>fanfanpao</dc:creator>
      <dc:date>2019-10-04T11:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: cannot use ../ in the linux sas pipe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594070#M170612</link>
      <description>&lt;P&gt;Please post the whole code you used with the filename pipe.&lt;/P&gt;
&lt;P&gt;And keep in mind that the commandline has a different current working directory than the SAS workspace server.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 11:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594070#M170612</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-04T11:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: cannot use ../ in the linux sas pipe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594073#M170613</link>
      <description>Are the SAS "./" and commandline's "./" the same?&lt;BR /&gt;Try "pwd; ls ../*.txt:?&lt;BR /&gt;Bart</description>
      <pubDate>Fri, 04 Oct 2019 12:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594073#M170613</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-10-04T12:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: cannot use ../ in the linux sas pipe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594074#M170614</link>
      <description>pls note that i run the code in the batch mode. i assume ./ is the same path of the program, and ../ is the path of up level folder of the program. i will take a try of pwd command later. thank you both.</description>
      <pubDate>Fri, 04 Oct 2019 12:10:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594074#M170614</guid>
      <dc:creator>fanfanpao</dc:creator>
      <dc:date>2019-10-04T12:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: cannot use ../ in the linux sas pipe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594558#M170837</link>
      <description>&lt;P&gt;I &lt;STRONG&gt;never&lt;/STRONG&gt; use relative paths and always start from a drive or root mount point just in case something like a batch system for some reason has a different execution default locations(different config files can do that).&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 21:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594558#M170837</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-10-07T21:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: cannot use ../ in the linux sas pipe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594569#M170844</link>
      <description>&lt;P&gt;The execution location is not necessarily that of the program file.&lt;/P&gt;
&lt;P&gt;See your config file(s).&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 22:15:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594569#M170844</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-10-07T22:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: cannot use ../ in the linux sas pipe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594647#M170883</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269672"&gt;@fanfanpao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;pls note that i run the code in the batch mode.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please note that (as an example) sasbatch.sh in Lev1/SASApp/Batchserver calls Lev1/SASApp/ calls&amp;nbsp;appservercontext_env.sh, which explicitly sets the working directory to Lev1/SASApp.&lt;/P&gt;
&lt;P&gt;Similar things can (and will) happen in other SAS batch scripts.&lt;/P&gt;
&lt;P&gt;Bottom line: NEVER use a relative path unless you have already explicitly set the required current working directory yourself. See Maxim 31.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 06:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594647#M170883</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-08T06:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: cannot use ../ in the linux sas pipe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594674#M170896</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269672"&gt;@fanfanpao&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;one another thing which came into my mind, if you know the "wanted" starting location in advance, would be use of DLGCDIR() function, to change current working directory, like in the example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put *%sysfunc(pathname(WORK))*;
%put *%sysfunc(DLGCDIR(%sysfunc(pathname(WORK))))*;

filename test "."; /*fileref to working dir*/
filename test list;
filename test clear;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which in my case gave:&lt;/P&gt;&lt;PRE&gt;1
2    %put *%sysfunc(pathname(WORK))*;
*C:\SAS_Temporary_Files\_TD4300_H48LBFI12PS0510_*
3    %put *%sysfunc(DLGCDIR(%sysfunc(pathname(WORK))))*;
NOTE: The current working directory is now "C:\SAS_Temporary_Files\_TD4300_H48LBFI12PS0510_".
*0*
4
5    filename test "."; /*fileref to working dir*/
6    filename test list;
NOTE: Fileref= TEST
      Physical Name= C:\SAS_Temporary_Files\_TD4300_H48LBFI12PS0510_
7    filename test clear;
NOTE: Fileref TEST has been deassigned.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One disadvantage, it requires SAS 9.4M5 (or 4) to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best&lt;/P&gt;&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 08:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cannot-use-in-the-linux-sas-pipe/m-p/594674#M170896</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2019-10-08T08:59:02Z</dc:date>
    </item>
  </channel>
</rss>

