Hi,
I am preparing an HTML report in SAS on Enterprise Guide. It is mostly a details entering page with drop down and textboxes. I was able to use Macros for setting up the dropdowns. Now I need to display a table on the html page. The table has to be positioned on a particular part of the page and hence the code for the table display has to be within the HTML code.
Kindly suggest how I can display an entire table from database on to an HTML page in SAS EG.
Thanks in advance.
To do what? Is it just for display, will you need update/refresh/enter data, etc. If its simply a display, then just add in the tags, and data from your dataset when you write the HTML file, example here: HTML Tables
If its other, then you may want to look at PHP scripting, with a javascript handler.
Hi, I need to just display data from a table depending on a condition on to the HTML page.
I am not sure how I can do that with within the HTML tags.. like I am displaying the database/dataset details as a column of a HTML table element. Any hints as to how I can achieve it.
So your not putting data out when the report is generated then. What you are talking about is a web page with user interaction which loads data from a database. This is far more complicated then just creating a HTML document. You could look at PHP scripting, which is used for connecting to databases via web pages: http://en.wikipedia.org/wiki/PHP
Using Javascript/VBScript coding within you HTML page. Or there is ASP.
These are more advanced topics however, and out of scope of a SAS forum.
Maybe you need one of the other packages that SAS offers, Web Report Studio for example?
Looks like the perfect case for a stored process run via the STP server and the /SASStoredProcess URL
Hi Kurt,
I am using Stored process for the HTML page, since I have to use macros.
Could you elaborate on your idea. I didn't quite understand on how to proceed.
So you already send out the HTML from a STP, and then want it to display an additional table?
Where the original HTML includes a FORM element that lets the user select a table/dataset to display?
Why not call the same STP again, with a parameter that includes the dataset name, and have the STP recreate the HTML page, but now with the table inserted?
Hi,
I tried using a proc print and a proc report by defining the PROC statements in a macro and then calling the macro in the HTML part.
but the HTML treats the statements inside as text and just displays the statements on the screen rather than to execute them.
Can you suggest any commands or functionality to execute the macro statements.
a) define your meaning of "macro"
b) you can't just write SAS code into a HTML page and hope it will execute. But you can call a predefined Stored Process via the StoredProcessServer
How have you created the HTML page withe stored process up to now, and how do you invoke it (provide an example)?
Hi Kurt,
I had to prepare a report in SAS incorporating HTML. I have made use of textboxes and dropdowns using macro variables as their input, setting the value of the form elements with macro variables in javascript.
I concatenate values from dataset into a macro variable and call the macro variable in the HTML statement and it has been working so far.
I have been trying to use the same idea for displaying the table. defining a proc print statement inside a macro and then calling the macro in the HTML.
sample code:
%macro test ;
proc report data=dataset;
title test;
run;
%mend test;
data _null;
input;
put line;
cards4;
<html>
<head>
</head>
<body>
<form name="ADD_SHARE" method="POST">
<br>
<table>
<tr><td>
%test
</td></tr>
</table>
</form>
</html>
;;;;
run;
Since the macro %test is used within the range of the CARDS statement, its generated text is not considered SAS code, but plain text for the input statement. That's why you see it as text in the web page.
This:
http://support.sas.com/documentation/cdl/en/stpug/67499/PDF/default/stpug.pdf
will help you in developing your stored process.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.