The SAS Output Delivery System and reporting techniques

excel to html converter in sas

New Contributor
Posts: 4

excel to html converter in sas


I would like to know is there any way to convert multiple excel sheets into html directly with headder's and footnote's into sas.It should be automated.

For example  one of my excel sheet contains data like as below

7000 7000 7000 7000 7000

FOOTNOTE:asjgdfghasfd dasdgyasjdgj dasdjasjd asjdgjad.

As the above assume that, There were multiple sheets i have in one file.Plz Help me out of this...

Posts: 8,645

Re: excel to html converter in sas


  I'm not sure why you need SAS for this task. Every since Office 97, you have been able to do a File-->Save As inside of Excel (and Word) to save your workbook or document as an HTML file. You have 2 choices with Excel -- either an HTML file or an MHT file. If you ask SAS to read the Excel sheet using PROC IMPORT or the LIBNAME engine, the data is a mixture of information. You do not have a simple structure of rows and columns. You could, for example, tell SAS to start reading data at row 5 or row 6 and to get the column headers out of row 4 or row 5, but I think that's not what you want.

  Why can't you use Excel techniques to create your HTML file?


New Contributor
Posts: 4

Re: excel to html converter in sas

Hi Thanks for your reply,

Actually i need to make this requirement as automated in SAS, As you told, we can do this with Excel techniques,But my user's want to make this automated process in sas,Can you help me out of this....

Respected Advisor
Posts: 3,660

Re: excel to html converter in sas

The question is: What tells you in the Excel sheet what's header, what's body and what's footnote? Excel has simply columns and rows.

You would need to implement some kind of logic to identify the header/footer section.

I've had to do stuff like this in the past and it's ugly. My solution was to first convert the Excel to a csv and then implement some logic which determined if this was header or data section. In my case I needed to read only the data section into a SAS table, in your case you would then convert the text file to a html.

In the Excel sheet structur you show us a Proc Import with enough "guessingrow" would do as there will be at least one row (the column headings) with character values so all variables would be "character". Once you have the data in a SAS table you need to find logic to split it up into header, data and footer section and then write the data as you wish to a html.

If you have PC File Server then you could simply define a libname for your Excel workbook and by querying the sashelp.vstable it shouldn't be hard to get all the names of the sheets in this workbook.

May be the libname would already convert the Excel sheets into a format sufficient for further processing. I've made mixed experiences and it was always "try and error" for me.

Post a Question
Discussion Stats
  • 3 replies
  • 3 in conversation