BookmarkSubscribeRSS Feed
Anand6666
Calcite | Level 5


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.

10 REPLIES 10
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Anand6666
Calcite | Level 5

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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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?

Anand6666
Calcite | Level 5

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.

Kurt_Bremser
Super User

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?

Anand6666
Calcite | Level 5

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.

Kurt_Bremser
Super User

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)?

Anand6666
Calcite | Level 5

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;

Kurt_Bremser
Super User

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.

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