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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.