<?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 Read folder or file name or table  starts with a word in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-folder-or-file-name-or-table-starts-with-a-word/m-p/531718#M145589</link>
    <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Folder Question:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;folder path = [path]\folder_YYYYMMDD;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just like to know how to use folder &lt;STRONG&gt;starts with&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;libname "[path]\folder_*";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;File Question:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;file name&amp;nbsp; = [path]\filename&lt;STRONG&gt;_xxxxxx&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export data=Pred_All_Region1_final&lt;BR /&gt;outfile="[path]\filename&lt;STRONG&gt;_*&lt;/STRONG&gt;"&lt;BR /&gt;dbms=csv replace;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I like to know how to read a folder or file starts with a &lt;STRONG&gt;name&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Jan 2019 17:09:01 GMT</pubDate>
    <dc:creator>sidpesar</dc:creator>
    <dc:date>2019-01-31T17:09:01Z</dc:date>
    <item>
      <title>Read folder or file name or table  starts with a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-folder-or-file-name-or-table-starts-with-a-word/m-p/531718#M145589</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Folder Question:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;folder path = [path]\folder_YYYYMMDD;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just like to know how to use folder &lt;STRONG&gt;starts with&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;libname "[path]\folder_*";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;File Question:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;file name&amp;nbsp; = [path]\filename&lt;STRONG&gt;_xxxxxx&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export data=Pred_All_Region1_final&lt;BR /&gt;outfile="[path]\filename&lt;STRONG&gt;_*&lt;/STRONG&gt;"&lt;BR /&gt;dbms=csv replace;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I like to know how to read a folder or file starts with a &lt;STRONG&gt;name&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 17:09:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-folder-or-file-name-or-table-starts-with-a-word/m-p/531718#M145589</guid>
      <dc:creator>sidpesar</dc:creator>
      <dc:date>2019-01-31T17:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Read folder or file name or table  starts with a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-folder-or-file-name-or-table-starts-with-a-word/m-p/531777#M145628</link>
      <description>&lt;P&gt;Describe what you mean by "read a folder"?&lt;/P&gt;
&lt;P&gt;If you mean "read every file in a folder" that is one thing but "read a folder" isn't obvious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You say read a file and then show proc Export?&lt;/P&gt;
&lt;P&gt;Proc IMPORT will attempt to read multiple files when you use something like:&lt;/P&gt;
&lt;PRE&gt;proc import datafile = "X:\Data\IPP\Data\Text data\2018\ada*"
  out=work.junk
  dbms=CSV  replace
  ;
run;&lt;/PRE&gt;
&lt;P&gt;Which will "read" all of the files in the folder that start with ADA in the name. However my folder has a mix of CSV and XLSX files and attempts to read both. It creates a data set without an error &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;BUT&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; there is binary data not actual values.&lt;/P&gt;
&lt;P&gt;If I restrict it to&lt;/P&gt;
&lt;PRE&gt;proc import datafile = "X:\Data\IPP\Data\Text data\2018\ada*.CSV"
  out=work.junk
  dbms=CSV  replace
  ;
run;&lt;/PRE&gt;
&lt;P&gt;The result makes somewhat more sense but every single variable is character because the header row with the variable names is treated as character when read multiple times (the files have few rows).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So describe what you actually want to do in a bit more detail and what you expect the results to be.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 19:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-folder-or-file-name-or-table-starts-with-a-word/m-p/531777#M145628</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-31T19:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Read folder or file name or table  starts with a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-folder-or-file-name-or-table-starts-with-a-word/m-p/531788#M145632</link>
      <description>&lt;P&gt;Thanks I thought * wont work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 20:05:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-folder-or-file-name-or-table-starts-with-a-word/m-p/531788#M145632</guid>
      <dc:creator>sidpesar</dc:creator>
      <dc:date>2019-01-31T20:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Read folder or file name or table  starts with a word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-folder-or-file-name-or-table-starts-with-a-word/m-p/531814#M145643</link>
      <description>&lt;P&gt;I have several programs that read multiple files, partially because I get replacements and need to make sure that I have the latest data.&lt;/P&gt;
&lt;P&gt;The start of one of them looks like this&lt;/P&gt;
&lt;PRE&gt;data output  ;
   infile "x:\data\IPP\data\Text Data\2018\IDEX*.DAT" delimiter='09'x  DSD lrecl=32767 firstobs=2 eov=skip missover;
&lt;/PRE&gt;
&lt;P&gt;because with a data step I get to do things like skip the first row in the intermediate files. The EOV option creates a variable that has value of 1 when the first record of a new set is encountered. Which means I can test that value and do things needed for the next file, like skip reading the header row in the middle of a data stream. I also get to test if some of the data content changes in an expected manner.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't be afraid to try the occasional bit of odd syntax. Just make sure that anything that might be taken as an output data set name doesn't reference data you don't mind losing if something unexpected happens.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2019 21:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-folder-or-file-name-or-table-starts-with-a-word/m-p/531814#M145643</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-31T21:06:11Z</dc:date>
    </item>
  </channel>
</rss>

