Creating a SAS dataset from an HTML batch file

Reply
New Contributor
Posts: 4

Creating a SAS dataset from an HTML batch file

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

Attachment
Valued Guide
Posts: 3,208

Re: Creating a SAS dataset from an HTML batch file

What you included is looking like a part a XML file. Is that what you to ceate or is it like AJAX?

---->-- ja karman --<-----
New Contributor
Posts: 4

Re: Creating a SAS dataset from an HTML batch file

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.

New Contributor
Posts: 4

Re: Creating a SAS dataset from an HTML batch file

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.

20         run;

Super User
Posts: 6,940

Re: Creating a SAS dataset from an HTML batch file

The root error is "Physical file does not exist". Try to repair that (physical filename should end with .xml instead of .html) before advancing.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Valued Guide
Posts: 3,208

Re: Creating a SAS dataset from an HTML batch file

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

---->-- ja karman --<-----
New Contributor
Posts: 4

Re: Creating a SAS dataset from an HTML batch file

Cheers. Thanks for you help.

Super User
Posts: 9,681

Re: Creating a SAS dataset from an HTML batch file

As Jaap suggested, it looks like it is a XML file .  and what output you need ?

data x;

infile 'c:\temp\HTML_batch_file_sample.html' dsd dlm='<>' ;

input @'>' x : $100. @@;

if not missing(x);

run;

Xia Keshan

Ask a Question
Discussion stats
  • 7 replies
  • 410 views
  • 3 likes
  • 4 in conversation