BookmarkSubscribeRSS Feed
4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

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

 

Thanks,
Jag
thanikondharish
Fluorite | Level 6
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 ?
Tom
Super User Tom
Super User

@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.

Kurt_Bremser
Super User

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 9208 views
  • 2 likes
  • 4 in conversation