There is a similar post in sas communities, hope it helps
https://communities.sas.com/t5/Base-SAS-Programming/Read-htm-files-into-SAS-dataset/td-p/10774
@thanikondharish wrote:
sorry,it doesn't give full clarity to me.
I exported sashelp.class data set as html file by using ods option. Now
how to get that html file into sas as a data set ?
Don't do that. HTML files are a DISPLAY format, not a data storage format.
If you want to put data into a text file then make a CSV file. Or if you want to use a lot of extra disk space, but have a way to store at least some metadata about the data, then an XML file.
If you have an HTML file with a table then copy the table and paste it into an Excel sheet. Excel is pretty good at converting HTML tables into cells in a spreadsheet.
Read the linked post. HyperText Markup Language is designed for all kinds of text, while SAS works with tabular data. So you need to find the <TABLE> </TABLE> part that is of interest to you, and then read the tagged TD fields into variables, where TR signals the start and /TR the end if a row.
Bottom line, there is no simple way to do it. html files are not suited for data import.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.