05-25-2014 09:32 PM
Hello SAS Comm,
Need some help with parsing a HTML batch file in order to create a SAS dataset. Attached is a sample of the HTML batch file containing two dummy data records. Each records begins at the line = <Application> and ends at the line </Application>. In a real life example the batch file will contain many thousands of records. Any assistance would be greatly appreciated. Thanks
05-26-2014 01:52 AM
It would be coming out of something like AJAX as it is via a B2B process. I just kept the first two records (<Application> x 2) from a recent file transfer. I though it was XML too but when I tried using the XML libname engine to assist with importing into a SAS data set it came back with errors saying iot wasn't in XML format? I'll try it again using the full file unedited.
05-26-2014 02:08 AM
Tried the original file with the XML libname engine and still get the same error as per my sample file -
18 data xml;
19 set in.CREATE_201402070702184;
ERROR: Physical file does not exist, \\fp02syd\analytics$\08_Users\Dave_H\EBDM\cba_dua_data\CREATE_201402070702184.xml.
encountered during XMLMap parsing
occurred at or near line 1, column 1
XML file is empty, corrupt, or XML data is not in a format supported by the XML libname engine: CREATE_201402070702184
ERROR: XML describe error: Internal processing error.
05-26-2014 02:58 AM
The root error is "Physical file does not exist". Try to repair that (physical filename should end with .xml instead of .html) before advancing.
05-26-2014 02:19 AM
You cannot read always a XML file that way as there are many conventions with XML and not all are known. There must be a header of some type (did not see that).
There is a XMLMapper tool on the BI instalation that will roll out that tool. It will help to set up a translation definition. SAS(R) 9.3 XML LIBNAME Engine: User's Guide, Second Edition
05-26-2014 09:13 AM
As Jaap suggested, it looks like it is a XML file . and what output you need ?
infile 'c:\temp\HTML_batch_file_sample.html' dsd dlm='<>' ;
input @'>' x : $100. @@;
if not missing(x);