<?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: Import all excel files with hebrew names from a folder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774673#M246237</link>
    <description>&lt;P&gt;The following code could get you all the excel file name. After that using 'call execute()' to import these excel file .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let subdir=c:\temp\  ;


data _null_;
 rc=filename('x',"&amp;amp;subdir");
 did=dopen('x');
 do i=1 to dnum(did);
   filename=dread(did,i);
   put filename=;
   /*call execute(); &amp;lt;- import all the xlsx files*/
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 16 Oct 2021 11:34:27 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-10-16T11:34:27Z</dc:date>
    <item>
      <title>Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774669#M246234</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to read all excel files(.xlsx) from a one folder. My problem that files have hebrew names, and when i read them filename contains gibberish for the name of files.&lt;/P&gt;&lt;P&gt;The code i use is a follows :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let subdir=D:\sasdata\;
filename dir pipe "dir &amp;amp;subdir.*.xlsx /B";
data new;
infile dir truncover end=last;
input filename $100.;
filename=cats("&amp;amp;subdir",filename);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2021 11:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774669#M246234</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-10-16T11:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774673#M246237</link>
      <description>&lt;P&gt;The following code could get you all the excel file name. After that using 'call execute()' to import these excel file .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let subdir=c:\temp\  ;


data _null_;
 rc=filename('x',"&amp;amp;subdir");
 did=dopen('x');
 do i=1 to dnum(did);
   filename=dread(did,i);
   put filename=;
   /*call execute(); &amp;lt;- import all the xlsx files*/
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Oct 2021 11:34:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774673#M246237</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-10-16T11:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774675#M246239</link>
      <description>&lt;P&gt;Make sure that you have UTF session encoding. If the filenames already have Hebrew characters, you can bet that the data will also contain some.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2021 13:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774675#M246239</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-16T13:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774686#M246243</link>
      <description>&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;But how can i use call execute to import and concatenate them into one dataset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2021 17:55:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774686#M246243</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-10-16T17:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774715#M246249</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let subdir=c:\temp\  ;

options validvarname=any validmemname=extend;
data _null_;
 rc=filename('x',"&amp;amp;subdir");
 did=dopen('x');
 do i=1 to dnum(did);
   filename=dread(did,i);
   if upcase(scan(filename,-1,'.'))='XLSX' then 
call execute(catt('proc import datafile="&amp;amp;subdir.\',filename,'" out=',scan(filename,1,'.'),' dbms=xlsx replace;run;' ));
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Oct 2021 11:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/774715#M246249</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-10-17T11:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787361#M251575</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have more one question, can you please help me.&lt;/P&gt;&lt;P&gt;I run this code successfully. But my excel file names consist of name plus date like temp_24122021.&lt;/P&gt;&lt;P&gt;When i read them dynamically i want to save inside dataset also the date from the file name. Which way is more appropriate?&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;After&amp;nbsp; i read excel&amp;nbsp;temp_24122021.xlsx and created a new dataset&amp;nbsp;temp then i want to save inside temp&amp;nbsp; dataset variable&amp;nbsp; date=24/12/2021.&lt;/P&gt;&lt;P&gt;Of course i can also to read excel&amp;nbsp;temp_24122021.xlsx and created a new dataset temp_24122021 that contain date, but still the problem doesn't appear.&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2021 19:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787361#M251575</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-24T19:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787387#M251580</link>
      <description>&lt;P&gt;Sure. Just add some more code in it .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let subdir=c:\temp\  ;

options validvarname=any validmemname=extend;
data _null_;
 rc=filename('x',"&amp;amp;subdir");
 did=dopen('x');
 do i=1 to dnum(did);
   filename=dread(did,i);
   if upcase(scan(filename,-1,'.'))='XLSX' then do;
call execute(catt('proc import datafile="&amp;amp;subdir.\',filename,'" out=',scan(filename,1,'.'),' dbms=xlsx replace;run;' ));
call execute(cat('data ',scan(filename,1,'.'),';set ',scan(filename,1,'.'),'; 
 date=input("',scan(filename,-1,,'kd'),'",?? ddmmyy12.);format date ddmmyy10.;run;'));
end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Dec 2021 10:23:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787387#M251580</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-25T10:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787415#M251598</link>
      <description>&lt;P&gt;Great decision. Thank you.&lt;/P&gt;&lt;P&gt;One more question. I got an error when i wrote the following code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;call execute(cat('data ', strip(new),';set ', strip(new).';Name=scan(filename,1,'.'); run;'))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After that i want to concatenate all these "new" tables, can i? using call execute?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Dec 2021 18:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787415#M251598</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-26T18:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787443#M251607</link>
      <description>OK. Just add prefix before dataset name . Like :&lt;BR /&gt;&lt;BR /&gt;call execute(cat('data _new_',scan(filename,1,'.'),';set ',scan(filename,1,'.'),'; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;After that , you can set them all by :&lt;BR /&gt;data want;&lt;BR /&gt; set _new_: ;&lt;BR /&gt;run;</description>
      <pubDate>Mon, 27 Dec 2021 11:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787443#M251607</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-27T11:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787445#M251609</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Maybe I did not explain myself well. I want in same&amp;nbsp; table called new,&amp;nbsp; add a new variable named Name that his value should be "first".&amp;nbsp; My problem, that it doesn't work because of Name variable creation.&lt;/P&gt;&lt;PRE&gt;filename = "first.xlsx"&lt;CODE class=""&gt;&lt;BR /&gt;call execute(cat('data ', strip(new),';set ', strip(new).';&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Name=scan(filename,1,'.');&lt;/STRONG&gt;&lt;/FONT&gt; run;'))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 12:05:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787445#M251609</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2021-12-27T12:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Import all excel files with hebrew names from a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787446#M251610</link>
      <description>&lt;P&gt;OK. If I understood right. you want make a NEW variable which contain then first part of filename ,right ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;call execute(cat('data _new_',scan(filename,1,'.'),';set ',scan(filename,1,'.'),'; 
 date=input("',scan(filename,-1,,'kd'),'",?? ddmmyy12.);  
 &lt;STRONG&gt;length name $ 200;name="',scan(filename,1,'.'),'"; &lt;/STRONG&gt;   
 format date ddmmyy10.;run;'));&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Dec 2021 12:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-all-excel-files-with-hebrew-names-from-a-folder/m-p/787446#M251610</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-27T12:20:14Z</dc:date>
    </item>
  </channel>
</rss>

