<?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: Getting the path where a .sas file  is located. in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680608#M36902</link>
    <description>&lt;P&gt;My bad about the missing PIPE keyword. But you have to use the UNIX command&amp;nbsp;&lt;STRONG&gt;as I posted it&lt;/STRONG&gt;. No extra blanks, no changing of characters, only insert your path.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename findfile pipe "/dwh_actuariat/sasprocess/prodmens/Cer5/saspgm -name \*.sas 2&amp;gt;&amp;amp;1";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The backslash has a very special meaning in UNIX and is necessary here, and&lt;/P&gt;
&lt;PRE&gt;-name&lt;/PRE&gt;
&lt;P&gt;is one if the subcommands of find.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Sep 2020 04:43:27 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-09-01T04:43:27Z</dc:date>
    <item>
      <title>Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680108#M36890</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am using SAS EG 7.13 on a unix server.&amp;nbsp; I was able to put the list of all the folders in a macro variable.&lt;/P&gt;
&lt;P&gt;(see the code below).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let home = %sysget(HOME);&lt;BR /&gt;filename _folder_ "%bquote(/)";&lt;BR /&gt;data filenames(keep=memname);&lt;BR /&gt;handle=dopen( '_folder_' );&lt;/P&gt;
&lt;P&gt;if handle &amp;gt; 0 then do;&lt;BR /&gt;count=dnum(handle);&lt;BR /&gt;do i=1 to count;&lt;BR /&gt;memname=dread(handle,i);&lt;BR /&gt;output filenames;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;rc=dclose(handle);&lt;BR /&gt;run;&lt;BR /&gt;filename _folder_ clear;&lt;BR /&gt;proc sort data=filenames out=FolderList;&lt;BR /&gt;by memname;&lt;BR /&gt;run;&lt;BR /&gt;data FolderList;&lt;BR /&gt;set FolderList;&lt;BR /&gt;where memname not contains '.log';&lt;BR /&gt;run;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select memname into :list separated by ' '&lt;BR /&gt;from work.FolderList;&lt;BR /&gt;quit;&lt;BR /&gt;%put &amp;amp;list;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From there, I would like to make a macro tha will search for a specific file type in each subfolder (those of the &amp;amp;list) and give me the name and the path of a file having the extension .sas or .log or .spds9&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro Path_Name (path=&amp;amp;list, FileName=.sas);&lt;/P&gt;
&lt;P&gt;??????????????&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;%Path_Name (path=&amp;amp;list, FileName=.sas);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So If I execute the above mentionned macro which is not complete, I would like to get a listing of all the file ending by .sas as well as there location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We could execute the same macro to find the file ending by .log or .spd9 and so on as well as there path.&lt;/P&gt;
&lt;P&gt;Does someone know how to get this info on a unix server.&lt;/P&gt;
&lt;P&gt;regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 20:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680108#M36890</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2020-08-28T20:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680110#M36891</link>
      <description>&lt;P&gt;If XCMD is enabled, it is much easier to use the UNIX find command.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 20:56:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680110#M36891</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-28T20:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680111#M36892</link>
      <description>&lt;P&gt;Another way is to get your server administrator to set up folder shares so you can view the folders from your PC.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 21:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680111#M36892</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-08-28T21:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680123#M36893</link>
      <description>&lt;P&gt;See the first two macros in the macro appendix.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="xis-toc_1"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/n0ctmldxf23ixtn1kqsoh5bsgmg8.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Example 1: Import All CSV Files That Exist within a Directory&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV class="xis-toc_1"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/n0js70lrkxo6uvn1fl4a5aafnlgt.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Example 2: List All Files within a Directory Including Subdirectories&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV class="xis-toc_1"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-toc_1"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 28 Aug 2020 21:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680123#M36893</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-28T21:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680509#M36895</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have very little experience with Unix.&amp;nbsp; First, how can we check if the xcmd command is enabled.&lt;/P&gt;
&lt;P&gt;how do we use it. is it a command line that we execute from putty or is it also possible to execute it from a SAS environment and if so, how do we do that.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 18:45:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680509#M36895</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2020-08-31T18:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680511#M36896</link>
      <description>&lt;P&gt;First, run this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option=xcmd;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If XCMD is enabled, run this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename findfile "find /path_to_your_programs -name \*.sas 2&amp;gt;&amp;amp;1";

data programs;
infile findfile truncover;
input program $200.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Aug 2020 18:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680511#M36896</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-31T18:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680528#M36897</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have checked if the xcmd is enable. it is the case.&lt;/P&gt;
&lt;P&gt;However, IF I am not wrong, you are trying to genate the unix command Find / path - name /*.sas&amp;nbsp;2&amp;gt;&amp;amp;1&lt;/P&gt;
&lt;P&gt;but it not what we get.&amp;nbsp; Any idea how to solve that issue.&lt;/P&gt;
&lt;P&gt;Please see the log file&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 19:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680528#M36897</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2020-08-31T19:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680532#M36898</link>
      <description>&lt;P&gt;You need to tell SAS to use the PIPE engine to get it to treat that string as a command and not the name of a file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename findfile PIPE "find /dwh_actuariat/sasprocess/prodmens/Cer5/saspgm/ - name  /*.sas 2&amp;gt;&amp;amp;1";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Aug 2020 20:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680532#M36898</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-31T20:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680549#M36900</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have added the PIPE and it works better.&lt;/P&gt;
&lt;P&gt;However, if I want to go at a previous level, let's say from&amp;nbsp;/dwh_actuariat/sasprocess/prodmens/Cer5/saspgm/&lt;/P&gt;
&lt;P&gt;to&amp;nbsp;/dwh_actuariat/sasprocess/prodmens/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it gives me everything, the txt file, sas file and so on.&amp;nbsp; It is like it does not interpret properly the extension.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if I want to look at all the subfolder from&amp;nbsp;/dwh_actuariat/, do I need to add more parameters with the find command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 20:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680549#M36900</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2020-08-31T20:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680608#M36902</link>
      <description>&lt;P&gt;My bad about the missing PIPE keyword. But you have to use the UNIX command&amp;nbsp;&lt;STRONG&gt;as I posted it&lt;/STRONG&gt;. No extra blanks, no changing of characters, only insert your path.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename findfile pipe "/dwh_actuariat/sasprocess/prodmens/Cer5/saspgm -name \*.sas 2&amp;gt;&amp;amp;1";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The backslash has a very special meaning in UNIX and is necessary here, and&lt;/P&gt;
&lt;PRE&gt;-name&lt;/PRE&gt;
&lt;P&gt;is one if the subcommands of find.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 04:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680608#M36902</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-01T04:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680691#M36907</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You code is very fast and works but it bring everything.&amp;nbsp; It is like it does not recognize the .sas extension.&lt;/P&gt;
&lt;P&gt;I have made some tests with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename findfile PIPE "find /dwh_actuariat/sasprocess/prodmens/ - name \*.sas 2&amp;gt;&amp;amp;1";&lt;/P&gt;
&lt;P&gt;filename findfile PIPE "find /dwh_actuariat/sasprocess/prodmens/ - name /*.sas 2&amp;gt;&amp;amp;1";&lt;/P&gt;
&lt;P&gt;filename findfile PIPE "find /dwh_actuariat/sasprocess/prodmens/ - name *.sas 2&amp;gt;&amp;amp;1";&lt;/P&gt;
&lt;P&gt;filename findfile PIPE "find /dwh_actuariat/sasprocess/prodmens/ - name .sas 2&amp;gt;&amp;amp;1";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and it does not make any difference. I am getting around 68000 records instead of 11000 records&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have an idea why.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 13:16:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680691#M36907</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2020-09-01T13:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680702#M36908</link>
      <description>&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;PLEASE PAY ATTENTION TO DETAILS!&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;- name&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;/FONT&gt;is different from&lt;/P&gt;
&lt;PRE&gt;-name&lt;/PRE&gt;
&lt;P&gt;!!!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 14:28:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680702#M36908</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-01T14:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the path where a .sas file  is located.</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680708#M36909</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Thank you very much for the precision on the difference between -name and - name for Unix.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following code works perfectly.&amp;nbsp; Thank you very much&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc options option=xcmd;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;filename findfile PIPE "find /dwh_actuariat/sasprocess/prodmens/ -name \*.sas 2&amp;gt;&amp;amp;1";&lt;/P&gt;
&lt;P&gt;data programs;&lt;BR /&gt;infile findfile truncover;&lt;BR /&gt;input path $200.;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 14:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-the-path-where-a-sas-file-is-located/m-p/680708#M36909</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2020-09-01T14:51:35Z</dc:date>
    </item>
  </channel>
</rss>

