BookmarkSubscribeRSS Feed
mmkr
Quartz | Level 8

May i know if we Can read HTML file in sas and convert into PDF ? 

 

Currerntly Iam using third party tools like PDFMYURL.com and so on..

 

I just want read final output.html file and conver into pdf

 

 

3 REPLIES 3
Reeza
Super User

Is the output.html file from SAS? Can you provide some more details?

 

There's no direct method, but if it's SAS output that can also be redirected to a PDF file. You can also use third party tools directly from SAS using the X/SYSEXEC command to call them.

mmkr
Quartz | Level 8

yes , the HTML output is from SAS

 

Basically I didn't wrote any html code inside the sas code , First we created the html_template and then we passed macro variable to the html.
 
 
1) SAS code : 
 
data send_to_html;
set input_table;
/* define the code to run for each observation */
/*  /sas/config/ma/Lev1/SASMA/test*/
&LBL_ADT.;
code = 'filename letter "location/filename.html" ' 
||'lrecl=32767 ; '
||'proc stream outfile=letter mod quoting=both;  '
||'begin '
||'&streamdelim; %include test(html_template.html); '
||';;;;'
/*  ||'filename letter clear;'*/
;
/* run the code */
rc = dosubl(code);
run;

 

 
 
2) html template example : shorrex_template.html
 
 
<!DOCTYPE html>
<html>
<head>
<title>&Name.</title>
</head>
<body>
 
<h1>&first_name.</h1>  /*macro variable from sas */
<h1>&last_name.</h1>
<p>&short_desc_1.</p>
<p>&short_desc_2_1.</p>
<p>&short_desc_3_1.</p>
 
 
 
</body>
</html>
ballardw
Super User

The basic SAS output to PDF is ODS. You would place procedures that generate output between an ODS PDF destination statement and an ODS PDF Close statement.

 

ods pdf file="C:\path\myfile.pdf";

 

proc print data=sashelp.class;

run;

 

ods pdf close;

 

Would create the PDF file myfile.pdf in the folder C:\path and have the results of the proc print.

 

If you are writing raw html then this approach likely won't help.

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
  • 3 replies
  • 3384 views
  • 0 likes
  • 3 in conversation