BookmarkSubscribeRSS Feed
mmkr
Obsidian | Level 7

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
Obsidian | Level 7

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.

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