Using Web Technologies Effectively with SAS® : Using Web Technologies Effectively with SAS® WUSS 2000
by Sy Truong
Introduction : Introduction Describe the purpose and scope of the course
List the the tools and technologies included in the course
Provide general guidelines on when to use which tools
Purpose and Scope of Course : Purpose and Scope of Course The purpose of this course is to give SAS programmers the essentials to do the following:
Generate static reports and graphs via the Web
Develop dynamic Web systems
CGI-Based
Java-Based
Provide guidelines on the optimal use of these tools
Technologies Included : Technologies Included Report and Graph Generation
ODS and HTML
SAS Macros for HTML
CGI-Based
Application Dispatcher/Broker
Java-Based
JavaScript
WebAF
Architectural System Design : Architectural System Design Basic Web Architecture
Intranet versus Internet : Intranet versus Internet Same TCI/IP protocol across different networks
Static Web Pages : Static Web Pages Static HTML Example
Dynamic Web Pages : Dynamic Web Pages Dynamic HTML Example
SAS Technologies for Static Web Page : SAS Technologies for Static Web Page SAS Macro for HTML
ODS and HTML
User Developed SAS Programs
SAS Macros : SAS Macros %ds2htm - Data Set Formatter
%out2htm - Create HTML from SAS Proc Output
%tab2htm - Present PROC TABULATE output in HTML
%ds2graf - Present SAS/Graph output with GraphApplet
%meta2htm - Generate metadata for SAS/Graph in Java Applet
%ds2csf - Critical Success Factor
%ds2htm Example : %ds2htm Example title 'Formerly PROC SQL Output';
footnote '(Data generated by PROC MORTGAGE)';
%ds2htm(htmlfile=myfile.html,
openmode=replace,
pagepart=head,
data=monthly,
where=year eq 1996,
caption=Information for 1996);
%ds2htm Output : %ds2htm Output
%out2htm Example : %out2htm Example %out2htm(capture=on,
window=output,
runmode=b);
…
%out2htm(htmlfile=myfile.html,
capture=off,
window=output,
openmode=replace,
runmode=b);
%out2htm Output : %out2htm Output
%tab2htm Example : %tab2htm Example %tab2htm(capture=on,
runmode=b);
*** PROC TABULATE CODE… ***;
%tab2htm(capture=off,
runmode=b,
openmode=replace,
htmlfile=ex2.html,
brtitle=Tabulate Formatter Example,
center=Y,
tsize=+3);
%tab2htm Output : %tab2htm Output
%ds2graph Example : %ds2graph Example
%ds2graf(htmlfile=drill_test.html,
data=test,
name=Graph,
graphtyp=bar,
archive=http://web_server/GraphApplet.jar,
indepvar=symbol, depvar=price,
drildown=y,
drilurl=http://web_server/%nrstr({&g_indepv}).html,
ttag=header 2, tcolor=purple, center=y);
%ds2graph Output : %ds2graph Output
ODS and HTML Example : ODS and HTML Example /* Create HTML files. */
ods html file='odshtml-body.htm'
contents='odshtml-contents.htm'
page='odshtml-page.htm'
frame='odshtml-frame.htm';
proc univariate data=sashelp.adsmsg mu0=3.5;
var msgid lineno;
title;
run;
/* Close the HTML destination. */
ods html close;
ODS Output Example : ODS Output Example Outputs to both traditional text and HTML output
Large HTML document with hyperlinks
ODS Text Output : ODS Text Output
ODS HTML Output : ODS HTML Output
User Developed SAS Programs : User Developed SAS Programs HTML is essentially a text file
SAS has powerful tools for text manipulations and generation
SAS String Function Examples:
byte(), collate(), compbl(), compress(), dequote(), index(), indexc(), indexw(), left(), length(), lowcase(), quote(), rank(), repeat(), reverse(), right(), scan(), soundex(), substr(), translate(), tranwrd(), trim(), trimn(), upcase(), verify()
Simple Custom HTML Generator : Simple Custom HTML Generator
Custom HTML Output : Custom HTML Output Simple yet very powerful
Sophisticated Custom HTML : Sophisticated Custom HTML HTML tables & GIFs for diagrams
Publishing Tools Summary : Publishing Tools Summary Suitable for static publishing of HTML pages
Requires little HTML knowledge
Limited customization
Limited Dynamic HTML capabilities
Advantages and Disadvantages : Advantages and Disadvantages Report Generation
A: Quick Report Generation
D: Lack customization
Dynamic HTML Application
A: Powerful tools for HTML applications
D: Lack some GUI interactivity
Dynamic Java Based Applications
A: Create elaborate interfaces
D: Performance and learning curve
Installation of a Web Server : Installation of a Web Server No fear for simple http demon
Microsoft IIS, Apache
Apache Server General at: http://www.apache.org/httpd.html
Installing Apache 1.3.12 : Installing Apache 1.3.12 Download at: http://www.apache.org/dist/
Installing Apache 1.3.12 : Installing Apache 1.3.12 Follow instructions on screen.
Installing Apache 1.3.12 : Installing Apache 1.3.12
Installing Apache 1.3.12 : Installing Apache 1.3.12
Installing Apache 1.3.12 : Installing Apache 1.3.12
Apache Serves Up HTML and CGI : Apache Serves Up HTML and CGI Files stored on Apache directories are delivered via http
CGI software is stored in cgi-bin directory
Instant Web Services
Dynamic Web Page Technologies : Dynamic Web Page Technologies SAS/IntrNet CGI
SQL
Java Script
AppDev Studio
SAS/IntrNet CGI : SAS/IntrNet CGI Hello World Example
Data Access Example
Java Script : Java Script Fits into Architecture
Form Checking Example
AppDev Studio : AppDev Studio Hello World Example
Data Access Example
How it fits in
WebAF Hello World Applet Example : WebAF Hello World Applet Example Start a new project named HelloWorld Contrl+R or menu File > New > Project
WebAF Hello World Applet Example : WebAF Hello World Applet Example Recommended to have Name with no special characters.
Leave Java package empty
WebAF Hello World : WebAF Hello World Leave the default Parent Class
Leave the HTML blank for now. This can be added later
WebAF Hello World : WebAF Hello World Click on Finish to complete Wizard
WebAF Hello World : WebAF Hello World Add New Java Source Code with menu: File > New > Java Source
import java.awt.Graphics;
public class HelloWorld extends java.applet.Applet {
public void paint( Graphics g ) {
g.drawString( "Hello, World!", 60, 30 );
}
}
WebAF Hello World : WebAF Hello World Save Java Source File with menu: File > Save
Save file with extension (.java) For example: helloworld.java
Compile the program with menu: Build > Compile File
WebAF Hello World : WebAF Hello World Add new HTML source with menu: File > New > HTML Source
HelloWorld
WebAF Hello World : WebAF Hello World Save HTML file to helloworld.html with menu: File > Save
Update Project Property for html with menu: File Project Property
WebAF Hello World : WebAF Hello World Execute the Applet with menu: Build > Execute or Build > Execute in Browser
WebAF Hello World : WebAF Hello World There are many components to webAf applets
Learning curve for new development
Nice visual development environment
Performance of download to consider
Data Display Example : Data Display Example webAF delivers more interactivity
Data display is a slightly more sophisticated example
Data Display Example : Data Display Example Create a new project named tabledisplay with menu File > New > Project
Note that Java package has to be unique or left blank
Data Display Example : Data Display Example Use the default Parent class
Leave the HTML blank for now
Data Display Example : Data Display Example Click on the Finish button to create the project
Data Display Example : Data Display Example Add two list boxes by dragging ListBox item from Selector tab onto new applet
Data Display Example : Data Display Example New applet has Visual and Source code tabs
Data Display Example : Data Display Example Add two text labels on top of the list boxes
Text labels are found in the Text tab
Add a data view from the Data View tab
Data Display Example : Data Display Example Use layout tools to arrange components as shown here
Data Display Example : Data Display Example Drag non-visual models and drop them onto specified components
LibraryListInterface > Listbox1
DataSetListInterface > Listbox2
Data Display Example : Data Display Example When creating a connection for first time, select the options
Default will run on local machine
Further customizations are optional with webAF MiddleWare found under Services tools
Data Display Example : Data Display Example Set Properties
label1 > Select a library:
label2 > Select a data set:
Data Display Example : Data Display Example Establish Property Links
listbox1 (selectedItem) > dataSetListInterface1 (library)
Data Display Example : Data Display Example Establish Property Links
listbox2 (selectedItem) > dataSetInterface1 (library)
Data Display Example : Data Display Example Build Project with menu: Build > Build Project
Data Display Example : Data Display Example Start SAS Connect Spawner
Data Display Example : Data Display Example Execute the Applet with menu: Build > Execute
SAS/IntrNet Hello World Example : SAS/IntrNet Hello World Example Generate SAS program to produce HTML
data _null_;
file _webout;
put 'Content-type: text/html';
put ;
put '';
put 'Hello World!';
put '';
put 'Hello World!
';
put '';
put '';
run;
SAS/IntrNet Hello World Example : SAS/IntrNet Hello World Example Define libname to the SAS program in srvauto.sas
/*** Location of sample programs ***/
libname sample 'd:\sas\IntrNet\sample' access=readonly;
SAS/IntrNet Hello World Example : SAS/IntrNet Hello World Example Run Program from Browser
SAS/IntrNet Hello World Example : SAS/IntrNet Hello World Example Simple yet powerful
SAS/IntrNet eData Example : SAS/IntrNet eData Example Accessing data via slow internet connection is a challenge
eData uses SCL to optimize
eData is a SAS data viewer via a browser
SAS/IntrNet eData Example : SAS/IntrNet eData Example
eData HTML Generation : eData HTML Generation
Data: &datname &search &sort |
View By:
eData HTML Generation : eData HTML Generation
*** Set background colors ***;
if mod(i,2) = 0 then bgcolor = '#DCDCBA';
else bgcolor = '#ECECD9';
submit;
|
| &i
|
&varname |
&vartype |
&varlen |
&varfmt |
&varinfmt |
&varlabel |
&varnum |
endsubmit;
SAS/IntrNet eData Example : SAS/IntrNet eData Example Navigate through pages of 20 observations at a time with previous… and next… hyperlinks
Navigate to specific sections if the data is large
Fast viewing of data through slow connection
eData Mouse Click Events : eData Mouse Click Events
submit;
|
previous... |
endsubmit;
submit;
Obs: