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
Calcite | Level 5
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.

sas-innovate-2024.png

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.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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