Published on :
Reporting SASHELP

Report Launch Web Interface Generation

This code is also available in: Deutsch Español Français
This program dynamically builds a web interface (HTML form). It starts by extracting the list of available product lines from the `sashelp.orsales` table to create a dropdown list. Then, it outputs an HTML page to the web output (`_webout`) containing a form. This form allows the user to choose a product, an output format (HTML, PDF, CSV, RTF) and a style, then submit the request to execute a specific SAS© program.
Data Analysis

Type : SASHELP


The data feeding the dropdown list comes from the internal `sashelp.orsales` table. The rest of the content is statically defined in the code.

1 Code Block
PROC SQL
Explanation :
Selects distinct values from the `product_line` column in `sashelp.orsales`. Formats each value into an HTML `<option>` tag and stores the concatenated string in the `:options` macro variable.
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 :
Generates the HTML stream to the `_webout` destination (browser). Uses `cards4` to include inline HTML code. The `resolve` function allows macro variables (like `&options` previously generated, or `&_srvname`) to be interpreted within the raw data before sending.
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://&_srvname:&_srvport/&_url?" 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.