Published on :
Reporting SASHELP

Generate Stored Process Launch Form

This code is also available in: Deutsch Español Français
This script creates an HTML page containing a submission form. It first dynamically retrieves product lines from the SASHELP.ORSALES table to build a dropdown list. The form then allows the user to select a product, an output format (HTML, PDF, CSV, RTF), and an ODS style, then submits these choices to a Stored Process hosted on a specific server.
Data Analysis

Type : SASHELP


The data feeding the dropdown list comes from the system table 'sashelp.orsales'.

1 Code Block
PROC SQL
Explanation :
Selects distinct values from the 'product_line' column and constructs a string containing the corresponding HTML <option> tags, stored in the macro-variable :options.
Copied!
1PROC SQL ;
2 select distinct '<option value="'||strip(product_line)||'">'||strip(product_line)||'</option>'
3 into :options separated BY ' '
4 from sashelp.orsales ;
5QUIT ;
2 Code Block
DATA STEP
Explanation :
Writes HTML code to the reserved fileref '_webout' (web output stream). Uses the 'resolve' function to interpret the macro-variable &options within the raw data (cards4), thus integrating the dynamic product list into the HTML form.
Copied!
1DATA _null_ ;
2 file _webout ;
3 INPUT ;
4 line=resolve(_infile_) ;
5 put line ;
6 cards4 ;
7
8
9

Pick a report to RUN

10
"get" ACTION="http://d351tq92/SASStoredProcess/do?" target="content">
11<INPUT type="hidden" name="_program" value="/User Folders/phil/My Folder/test">
12
13&options
14
15
16
17
18
19
20
21
22
23
24
25
26
27<INPUT type="checkbox" name="_debug" value="log">Show log
28<INPUT type="checkbox" name="_debug" value="time">Show time taken
29
30
31<INPUT type="submit" value="Run">
32
33
35
36
37;;;;
38RUN ;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.