<?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: Read multiple .HTML Files into SAS Dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734849#M228917</link>
    <description>&lt;P&gt;What&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;proposes might or might not work for you depending on your environment. Can you please run below code and copy/paste from your SAS log to what these SAS macro variables resolve to? This will tell us what SAS version under which OS you're using.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=SYSSCP;
%put &amp;amp;=SYSSCPL;
%put &amp;amp;=SYSVLONG;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please also execute the following code and search in the log if you find "SAS/ACCESS Interface to PC Files"&amp;nbsp; - just tell us; don't share the whole log with us.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc setinit;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 17 Apr 2021 03:22:49 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-04-17T03:22:49Z</dc:date>
    <item>
      <title>Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734793#M228895</link>
      <description>&lt;P&gt;Hello Friends,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am working on a project where I have to read hundreds of html files stored as .xls into sas dataset so I can build the analytical process using that data. My initial proc import was unsuccessful. I was able to build import step in EG using File--&amp;gt; Import Data but can't do it for hundreds of files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternately, I was successful in opening a source data file in excel(it spit a warning that file format and extension are not aligned; understandable as data is HTML and file extension is .xls) and save it as a true .xls file and then using proc import to bring the data into sas. Problem is I have hundreds of files so it is impossible to do this with all those files one by one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have looked for articles on importing HTML files far and wide but can't find any recent article, using which I could build my code. Latest one was 2009 but I could not replicate the method exampled in it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hoping community will be able to help me as always.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 19:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734793#M228895</guid>
      <dc:creator>Apprentice</dc:creator>
      <dc:date>2021-04-16T19:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734807#M228903</link>
      <description>&lt;P&gt;There's a VBS macro here that converts XML to XLSX which you could then automatically import. It will do all files in a single folder.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/c51f58a009f8d315a200f34912e494b1" target="_blank"&gt;https://gist.github.com/statgeek/c51f58a009f8d315a200f34912e494b1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 20:52:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734807#M228903</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-16T20:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734848#M228916</link>
      <description>&lt;P&gt;&amp;nbsp;Thanks Rezza for your response .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am looking for process to bring in &lt;U&gt;HTML files into SAS dataset&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure if your recommended code will be helpful. Can you please confirm?&lt;/P&gt;</description>
      <pubDate>Sat, 17 Apr 2021 03:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734848#M228916</guid>
      <dc:creator>Apprentice</dc:creator>
      <dc:date>2021-04-17T03:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734849#M228917</link>
      <description>&lt;P&gt;What&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;proposes might or might not work for you depending on your environment. Can you please run below code and copy/paste from your SAS log to what these SAS macro variables resolve to? This will tell us what SAS version under which OS you're using.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=SYSSCP;
%put &amp;amp;=SYSSCPL;
%put &amp;amp;=SYSVLONG;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please also execute the following code and search in the log if you find "SAS/ACCESS Interface to PC Files"&amp;nbsp; - just tell us; don't share the whole log with us.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc setinit;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Apr 2021 03:22:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734849#M228917</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-04-17T03:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734851#M228918</link>
      <description>&lt;P&gt;Hi Patrick, thanks for looking into my request.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SYSSCP=LIN X64&lt;/P&gt;
&lt;P&gt;SYSSCPL=Linux&lt;/P&gt;
&lt;P&gt;SYSVLONG=9.04.01M6P110718&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Setinit;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Apprentice_0-1618630235122.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58157iBBA4460BB188324C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Apprentice_0-1618630235122.png" alt="Apprentice_0-1618630235122.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Apr 2021 03:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734851#M228918</guid>
      <dc:creator>Apprentice</dc:creator>
      <dc:date>2021-04-17T03:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734852#M228919</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/43360"&gt;@Apprentice&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for this info and it's what I "feared" it might be.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Enterprise Guide is your client. It's installed and runs in your client side Windows environment ("on your PC").&lt;/P&gt;
&lt;P&gt;You connect with the SAS EG client to a SAS Server. Code you write in your SAS EG gets sent to the SAS Server for execution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Import Wizard is a bit special. The Import Wizard actually runs client side and uses Windows components to import .xls(x) files. It then send the output SAS table to the SAS server where you can use it for further processing. Because the wizard does client side things it's nothing you can really automate - you just can re-run it out of EG once defined but to my knowledge there is no out of the box way available to automate the process so it loops over multiple source files in your local folder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to automate reading of the .xls(x) using SAS then the source files need to be in a location accessible by your SAS Server instance - so you would have to upload them to storage/a location accessible by the SAS server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reading Excel files using SAS needs SAS/Access Interface to PC Files licensed. From the looks of it you've got that. Reading .xls files needs also the SAS PC file server up and running and you will know how to connect to it. Have you ever read a .xls file in your environment using SAS code (i.e. Proc Import)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reading a .xls&lt;STRONG&gt;x&lt;/STRONG&gt; file is much easier and that's why&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;suggests to first convert the files from .xls to .xlsx. The code shared would dynamically generate .vbs scripts doing such a conversion but.... this .vbs code only works under Windows and your SAS Server is under Linux.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can think of two options right now:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Option 1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1. Batch convert all your .xls to .xlsx in your local Windows environment&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;- outside of SAS using some script. Could be pulled out of the code Reeza shared or you just Google something that fits your purpose. &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;There should be a lot out there&lt;/P&gt;
&lt;P&gt;&amp;nbsp; - as an alternative: Import all .html directly into a single .xlsx with a sheet per .html file. I've done some Googling and it looks like you could find something that does this for you. Having a single .xlsx workbook with sheets would make reading all the data out of SAS likely very simple - especially if all the data in the sheets end up to have the same structure (column headers starting on the same row and column in all sheets).&lt;/P&gt;
&lt;P&gt;2. Upload the created .xlsx files onto your Linux server&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; - Using WinSCP or some other client that can do this task&lt;/P&gt;
&lt;P&gt;3. Use SAS to read all the .xlsx in the server side folder location into SAS tables&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; - if you don't know how to do this then once you've got the .xlsx on the SAS server ask a new question here&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Option 2&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;1. Using EG import one of the .xls using the import wizard&lt;/P&gt;
&lt;P&gt;2. Create a task template&lt;/P&gt;
&lt;P&gt;3. Use this task template to import all the other .xls&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; - This is still a manual process but using a task template should at least avoid that you have to go through all the wizard screens for every single .xls&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;"Option 3"&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;It's eventually still worth to try to read some proper .xls saved on the SAS using the PC File Server. If you can make this work then next step would be to try the same with one of your existing .xls - I'm not sure if that's going to work given that they are not "proper" .xls. What did you do? Have you just changed the suffix from .htm to .xls?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe Option 1 is likely what will get you where you want to be.&amp;nbsp; ....or someone else comes up with an approach that's easier and I didn't think/know about.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Apr 2021 04:49:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734852#M228919</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-04-17T04:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734854#M228920</link>
      <description>&lt;P&gt;Many Thanks&amp;nbsp; Partick for the detailed and in-depth answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I had pure .xls files, that would be very easy to handle for me using a macro to loop through all the files and upload them onto a sas dataset without even converting those to .xlsx.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Issue is these are .HTML files saved with .XLS extension&lt;/U&gt;. When I use proc import engine to read .XLS files, it fails and spits out error because I am asking it to read .HTML which is sitting with a cloak of .XLS. These files are not even opening straight in Excel and spit out warning regarding file layout not matching file extension due to ExtensionHardening rules in Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;SO I am hoping to get some help with code to read HTML file into a SAS dataset&lt;/U&gt;. Meanwhile i am trying my luck with VBA to write a macro to save these files as .xls/.xslx&lt;/P&gt;</description>
      <pubDate>Sat, 17 Apr 2021 05:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734854#M228920</guid>
      <dc:creator>Apprentice</dc:creator>
      <dc:date>2021-04-17T05:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734866#M228927</link>
      <description>&lt;P&gt;"&lt;EM&gt;If I had pure .xls files, that would be very easy to handle for me using a macro to loop through all the files and upload them onto a sas dataset without even converting those to .xlsx.&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;IF the .xls is on the SAS Server side ...and then you don't need to "upload" any SAS dataset as it's already there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;Meanwhile i am trying my luck with VBA to write a macro to save these files as .xls/.xslx&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;VBA doesn't feel right. Could be VB, VBS, PowerShell or even something like Python.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Apr 2021 10:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/734866#M228927</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-04-17T10:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/735068#M228977</link>
      <description>&lt;P&gt;If those HTML files have a consistent structure, you can write a data step that reads all files in one swoop and extracts the TABLE data contained in them.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 09:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/735068#M228977</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-18T09:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/735365#M229085</link>
      <description>The VBA code is in the SAS script, remove the PUT and then run it from the text file manually. And obviously this workflow only makes sense if you're doing this once.</description>
      <pubDate>Mon, 19 Apr 2021 21:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/735365#M229085</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-19T21:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/735808#M229220</link>
      <description>&lt;P&gt;Hi Rezza, what code are you referring to ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 23:50:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/735808#M229220</guid>
      <dc:creator>Apprentice</dc:creator>
      <dc:date>2021-04-20T23:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple .HTML Files into SAS Dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/735980#M229279</link>
      <description>The Github link. SAS is just writing VBS code there.</description>
      <pubDate>Wed, 21 Apr 2021 14:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-multiple-HTML-Files-into-SAS-Dataset/m-p/735980#M229279</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-21T14:16:57Z</dc:date>
    </item>
  </channel>
</rss>

