logging in or signing up wuss2000 webclass Davide Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 118 Category: Education License: All Rights Reserved Like it (0) Dislike it (0) Added: February 05, 2008 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript 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 toolsTechnologies Included: Technologies Included Report and Graph Generation ODS and HTML SAS Macros for HTML CGI-Based Application Dispatcher/Broker Java-Based JavaScript WebAFArchitectural System Design: Architectural System Design Basic Web Architecture Intranet versus Internet: Intranet versus Internet Same TCI/IP protocol across different networksStatic Web Pages: Static Web Pages Static HTML ExampleDynamic 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 ProgramsSAS 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 hyperlinksODS 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 diagramsPublishing 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 ServicesDynamic 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 ExampleJava Script: Java Script Fits into Architecture Form Checking ExampleAppDev 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 > ProjectWebAF Hello World Applet Example: WebAF Hello World Applet Example Recommended to have Name with no special characters. Leave Java package emptyWebAF Hello World: WebAF Hello World Leave the default Parent Class Leave the HTML blank for now. This can be added laterWebAF 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 FileWebAF Hello World: WebAF Hello World Add new HTML source with menu: File > New > HTML Source <HTML> <HEAD> <TITLE>HelloWorld</TITLE> </HEAD> <BODY> <HR> <APPLET CODE="HelloWorld.class" NAME="HelloWorld" WIDTH=200 HEIGHT=200 > </APPLET> <HR> </BODY> </HTML> 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 exampleData 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 blankData 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 tabData Display Example: Data Display Example Use layout tools to arrange components as shown hereData 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 toolsData 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 ProjectData Display Example: Data Display Example Start SAS Connect SpawnerData 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 '<HTML>'; put '<HEAD><TITLE>Hello World!</TITLE></HEAD>'; put '<BODY>'; put '<H1>Hello World!</H1>'; put '</BODY>'; put '</HTML>'; 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 powerfulSAS/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 browserSAS/IntrNet eData Example: SAS/IntrNet eData Example eData HTML Generation: eData HTML Generation <td><font face="Verdana, Arial" color="#474723" size="1">Data: &datname &search &sort</font></td> <td align="center"><input type="submit" value="< Back" name="b_back"> <input type="submit" value="Search" name="b_search"> <input type="submit" value="Sort" name="b_sort"> <font color="#000000" face="Verdana, Arial" size="2"> <b> View By:</b></font><select name="view_by" size="1" onChange="submit()"> <option &viewsel1 value="Unformatted">Unformatted</option> <option &viewsel2 value="Formated">Formated</option> <option &viewsel3 value="Variables">Variables</option> </select> <select name="v_label" size="1" onChange="submit()"> <option &labsel1 value="Label Names">Label Names</option> <option &labsel2 value="Label Headers">Label Headers</option> <option &labsel3 value="Headers and Names">Headers and Names</option> </select> eData HTML Generation: eData HTML Generation *** Set background colors ***; if mod(i,2) = 0 then bgcolor = '#DCDCBA'; else bgcolor = '#ECECD9'; submit; <tr> <td bgcolor="#9C9C4E"><font face="Verdana, Arial" size="1" color="#F4F4F4"><b>&i</b></font> </td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varname</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&vartype</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varlen</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varfmt</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varinfmt</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varlabel</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varnum</font></td> </tr> 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 connectioneData Mouse Click Events: eData Mouse Click Events submit; <tr> <td bgcolor="#FFFFFF" colspan="&span"> <a href="&link"> <font face="Verdana, Arial" size="1">previous...</font></a></td> </tr> endsubmit; submit; <font color="#000000" face="Verdana, Arial" size="2"><b> Obs:</b> </font><select name="goobs" size="1" onChange="submit()"> <option &select value="1">1</option> endsubmit; SAS/IntrNet eData Example: SAS/IntrNet eData Example PROC CONTENTS like functionality SAS/IntrNet eData Example: SAS/IntrNet eData Example Viewing Variables with LabelseData Search : eData Search eData Search Logic: eData Search Logic if vartype = 'C' then do; if b_case = 'Yes' then criteria = searchby || ' like "%' || stext || '%"'; else criteria = 'upcase(' || searchby || ') like "%' || upcase(stext) || '%"'; search = '(' || searchby || ' containing "' || stext || '")'; end; submit sql continue; create table work.search as select * from templib.&datname where (&criteria); endsubmit; eData Hidden Fields: eData Hidden Fields <form name="myForm" action="&broker"> <input type="hidden" name="_PROGRAM" value= "datlib.datcat.datview2.scl"> <input type="hidden" name="_SERVICE" value="default"> <input type="hidden" name="form" value="datview"> SAS/IntrNet eData Example: SAS/IntrNet eData Example HTML connected to broker CGI and SAS is a powerful combination Besides SAS, HTML is the only other challenge, no Java required Level of interactivity is different Using HTML Table as Layout: Using HTML Table as Layout eData demonstrated effective use of table cell background colors HTML tables are effective layout for flow diagrams as shown in Trialex dependency diagram HTML Table Layout Tool: HTML Table Layout Tool Nested HTML tables form self contained cells to layout diagrams Dynamic diagrams fit any browserHTML Table Versatility: HTML Table Versatility Used inside Email messages Trialex Update uses email as information delivery Sample HTML Nested Table: Sample HTML Nested Table <table border="1"> <tr> <td>text in table 1<div align="left"> <table border="1"> <tr> <td>table 2 in table 1</td> </tr> </table> </div></td> </tr> </table> Using Java Script: Using Java Script Quick form field selection and validation Add Interactive Navigation Add Pop up Menu InteractivityJava Script Field Selection: Java Script Field Selection Select All button. Non-CGI with Java Script.Java Script Select Button : Java Script Select Button <input name="b_sel" onclick="selAll()" type="button” value="Select All"> function selAll() { toggle = toggle + 1; remainder = toggle % 2; if (remainder == 1) { document.myForm.selit[0].selected = true; . . . } if (remainder == 0) { document.myForm.selit[0].selected = false; . . . } return; } Java Script Navigation: Java Script Navigation Java Script for button to navigate to another location in the same HTML page.Java Script Navigation Code: Java Script Navigation Code <input type="button" value="Options..." name="b_opt" onClick="linkHandler('#Page2')"> function linkHandler(loc){ window.location.href = loc; if (loc=="#Page1") document.myForm.b_ok2.focus(); if (loc=="#Page2") document.myForm.b_back.focus(); return; }Java Script Pop up Menu: Java Script Pop up Menu Clicking on GIF images can pop up a menu Much greater interactivityJava Script Menu Source Sample: Java Script Menu Source Sample <a HREF="javascript:doMenu(’demog', '127923658207','3','127923658218')"> <img src="data.gif" width="4" height="4" border="0"></a> function doMenu(obj,parent,generat,objid) { document.myForm.object.value = obj; document.myForm.parent.value = parent; document.myForm.generat.value = generat; document.myForm.objid.value = objid; window.showMenu(window.jobMenu); return; }Including Show Menu Java Script: Including Show Menu Java Script <script LANGUAGE="JavaScript1.2" SRC="http://myserver/menu.js"></script> /** * Menu 0.8 990602 * by gary smith, July 1997 * Copyright (c) 1997-1999 Netscape * Communications Corp. */ function showMenu(menu, x, y, child) { if (!window.wroteMenu) return; if (document.layers) { ... Java Script is the Glue: Java Script is the Glue Static HTML pages can become interactive with Java Script Java Script is fast and integrates closely with HTML pages It is efficient since no trips to server are required It can link and add communications and interactivity between HTML objects to form the GLUE of HTML pagesUsing email with Internet Applications: Using email with Internet Applications Email used as information delivery Facilitating collaborative tools which enable groups to communicate effectivelyInformation Delivery: Information Delivery In this Trialex example, after a program has been submitted, an email in HTML format is sent with status of submitted SAS job.Collaborative Group Ware: Collaborative Group Ware Adding an email interface to a system can communicate relevant content through email. Email in SAS: Email in SAS Interactive SAS allows email facilitiesEmail with SAS/IntrNet: Email with SAS/IntrNet SAS Interactive dialog boxes are replaced with HTML forms Email facilities are executed with commands in batch SAS can access these through X system commands Many command line email tools are freely available on multiple platforms See more information on WUSS paper titled “SAS Information Delivery with Email and the Internet” Performance and Tuning: Performance and Tuning Decrease the time for user response Users lose interest and are frustrated when it goes on for more than five seconds Some optimization strategies Server Side Client Side Performance and Tuning: Performance and Tuning Splash Screen Establish browser/server connection Place server application onto memory Load Applets to clientsSplash Screen HTML Sample: Splash Screen HTML Sample <body OnLoad="runsubmit()"> <script language="JavaScript"> <!-- Hide function runsubmit () { document.startup.submit(); return; } // --> </script> Optimize SAS Queries: Optimize SAS Queries Use the right tools for the job DATA STEP SCL PROC SQLSpread out Application Load: Spread out Application Load Spread the load to multiple application servers for faster responseMultiple Application Server Configuration: Multiple Application Server Configuration Sample SAS Broker Configuration for multiple SAS application servers onto one machine SocketService default "Reuse existing session" ServiceDescription "Pages reference this generic server when they don't care which service is used." ServiceAdmin "Sy Truong" ServiceAdminMail "sy.truong@meta-x.com" Server myserver.meta-x.com Port 5001 5002 Use of JavaScript: Use of JavaScript Trips to Server adds 1 or 2 seconds depending on connection speeds JavaScript is delivered quickly as small text file and runs on the client Optimal use of both client processing and serverCreate Smaller Applets: Create Smaller Applets Create Java Applets only when necessary Keep them small for faster download timeBatch versus Interactive: Batch versus Interactive For long jobs, send it to batch server For fast shorter jobs, use run interactively and return results right awayHTML Optimization : HTML Optimization Optimize HTML Tables Avoid unnecessary table cells or nested tables Optimize GIFs / JPEG <img src="../images/metax.jpg" width="86" height="80”>Response Time Makes or Breaks: Response Time Makes or Breaks Performance is very significant for user experience It is naturally more productive when optimized This is one of the highest complaints and deserves attention Security: Security Important for intranet but more significant for internet Types of Security Secure Socket Layer Tunneling Session State Control Data Security Email SecuritySecure Socket Layer (SSL): Secure Socket Layer (SSL) Encryption of information from the Web Server and the browser (http) Secure Socket Layer (SSL): Secure Socket Layer (SSL) Socket is network API for communication Most often used to secure http (protocol for web browser) Other protocols such as NNTP, POP3, IMAP, etc.Got SSL?: Got SSL? Free versions available Apache Interface to SSL (http://www.modssl.org/) SSLeay free implementation of Netscape's Secure Socket Layer (http://psych.psy.uq.oz.au/~ftp/Crypto/) Many commercial products available Using SSL: Using SSL Once installed on web server update reference from: http://myserver/cgi-bin/broker.exe to https://myserver/cgi-bin/broker.exe Tunneling: Tunneling Secure communications between web servers and SAS Servers Common Scenario for Java AppletsHow Tunneling Works: How Tunneling Works First Web Browser (Client) loads HTML including Java Classes Applets communicate (i.e SAS/CONNECT) to web server (http) Web Server uses tunneling software Messaging Router (shrcgi) which passes request to SAS server with security by verifying approved web server approved SAS server with valid port approved user with access Using Tunneling: Using Tunneling Install the server programs on web server with configuration to include system information The routerUrl is set as a parameter on the <applet> tag in your HTML file. For example: <param name=routerUrl value="http://yourhost.com/cgi-bin/shrcgi.exe"> Session State Control: Session State Control Web knows no state of time Each session web page is cached on the browser (back button)Adding Session Logic: Adding Session Logic Keep track of user location in a data base Every update of a web page is trackedHTML Session Logic: HTML Session Logic Create a unique identifier for each HTML session Expire old HTML session and require re-login <form name="myForm" action="/cgi-bin/broker.exe"> <input type="hidden" name="_PROGRAM" value="mylib.mycat.myprog.scl"> <input type="hidden" name="_SERVICE" value="default"> <input type="hidden" name="usrname" value="struong"> <input type="hidden" name="session" value="0.570441"> ... Data Level Security : Data Level Security Lock up the data access OS level protection SAS password protects the specified dataSAS Code to Protect Data: SAS Code to Protect Data Sample SAS data step to password protect data Sample SQL code to password protect data data lockdata (pw=apple); set thedata; run; proc sql; create table lockdata (pw=apple) as select * from thedata; run;Email Security: Email Security SSL Applied to POP Server Email Attachments PKZIP with password protection Password Protect SAS Data Email an HTML link and the HTML page is locked Tools Dynamic Levels : Tools Dynamic Levels Degree of Difficulty : Degree of Difficulty Performance: Performance Recommendations for Static Publishing: Recommendations for Static Publishing Quick with limited customization: SAS HTML Formatting Macros Elaborate HTML publications: DATA STEP SCL Code HTML GenerationRecommended for Applications: Recommended for Applications Quick Development with Limited Customization WebAF & EIS predefined objects htmSQL Elaborate Systems Customized webAF for Java applets SAS/IntrNet with JavaScriptUsing Web Technologies Effectively with SAS®: Using Web Technologies Effectively with SAS® Questions? Sy Truong sy.truong@meta-x.com http://www.meta-x.com You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
wuss2000 webclass Davide Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 118 Category: Education License: All Rights Reserved Like it (0) Dislike it (0) Added: February 05, 2008 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript 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 toolsTechnologies Included: Technologies Included Report and Graph Generation ODS and HTML SAS Macros for HTML CGI-Based Application Dispatcher/Broker Java-Based JavaScript WebAFArchitectural System Design: Architectural System Design Basic Web Architecture Intranet versus Internet: Intranet versus Internet Same TCI/IP protocol across different networksStatic Web Pages: Static Web Pages Static HTML ExampleDynamic 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 ProgramsSAS 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 hyperlinksODS 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 diagramsPublishing 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 ServicesDynamic 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 ExampleJava Script: Java Script Fits into Architecture Form Checking ExampleAppDev 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 > ProjectWebAF Hello World Applet Example: WebAF Hello World Applet Example Recommended to have Name with no special characters. Leave Java package emptyWebAF Hello World: WebAF Hello World Leave the default Parent Class Leave the HTML blank for now. This can be added laterWebAF 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 FileWebAF Hello World: WebAF Hello World Add new HTML source with menu: File > New > HTML Source <HTML> <HEAD> <TITLE>HelloWorld</TITLE> </HEAD> <BODY> <HR> <APPLET CODE="HelloWorld.class" NAME="HelloWorld" WIDTH=200 HEIGHT=200 > </APPLET> <HR> </BODY> </HTML> 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 exampleData 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 blankData 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 tabData Display Example: Data Display Example Use layout tools to arrange components as shown hereData 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 toolsData 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 ProjectData Display Example: Data Display Example Start SAS Connect SpawnerData 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 '<HTML>'; put '<HEAD><TITLE>Hello World!</TITLE></HEAD>'; put '<BODY>'; put '<H1>Hello World!</H1>'; put '</BODY>'; put '</HTML>'; 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 powerfulSAS/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 browserSAS/IntrNet eData Example: SAS/IntrNet eData Example eData HTML Generation: eData HTML Generation <td><font face="Verdana, Arial" color="#474723" size="1">Data: &datname &search &sort</font></td> <td align="center"><input type="submit" value="< Back" name="b_back"> <input type="submit" value="Search" name="b_search"> <input type="submit" value="Sort" name="b_sort"> <font color="#000000" face="Verdana, Arial" size="2"> <b> View By:</b></font><select name="view_by" size="1" onChange="submit()"> <option &viewsel1 value="Unformatted">Unformatted</option> <option &viewsel2 value="Formated">Formated</option> <option &viewsel3 value="Variables">Variables</option> </select> <select name="v_label" size="1" onChange="submit()"> <option &labsel1 value="Label Names">Label Names</option> <option &labsel2 value="Label Headers">Label Headers</option> <option &labsel3 value="Headers and Names">Headers and Names</option> </select> eData HTML Generation: eData HTML Generation *** Set background colors ***; if mod(i,2) = 0 then bgcolor = '#DCDCBA'; else bgcolor = '#ECECD9'; submit; <tr> <td bgcolor="#9C9C4E"><font face="Verdana, Arial" size="1" color="#F4F4F4"><b>&i</b></font> </td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varname</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&vartype</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varlen</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varfmt</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varinfmt</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varlabel</font></td> <td bgcolor="&bgcolor"><font face="Verdana, Arial" size="1">&varnum</font></td> </tr> 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 connectioneData Mouse Click Events: eData Mouse Click Events submit; <tr> <td bgcolor="#FFFFFF" colspan="&span"> <a href="&link"> <font face="Verdana, Arial" size="1">previous...</font></a></td> </tr> endsubmit; submit; <font color="#000000" face="Verdana, Arial" size="2"><b> Obs:</b> </font><select name="goobs" size="1" onChange="submit()"> <option &select value="1">1</option> endsubmit; SAS/IntrNet eData Example: SAS/IntrNet eData Example PROC CONTENTS like functionality SAS/IntrNet eData Example: SAS/IntrNet eData Example Viewing Variables with LabelseData Search : eData Search eData Search Logic: eData Search Logic if vartype = 'C' then do; if b_case = 'Yes' then criteria = searchby || ' like "%' || stext || '%"'; else criteria = 'upcase(' || searchby || ') like "%' || upcase(stext) || '%"'; search = '(' || searchby || ' containing "' || stext || '")'; end; submit sql continue; create table work.search as select * from templib.&datname where (&criteria); endsubmit; eData Hidden Fields: eData Hidden Fields <form name="myForm" action="&broker"> <input type="hidden" name="_PROGRAM" value= "datlib.datcat.datview2.scl"> <input type="hidden" name="_SERVICE" value="default"> <input type="hidden" name="form" value="datview"> SAS/IntrNet eData Example: SAS/IntrNet eData Example HTML connected to broker CGI and SAS is a powerful combination Besides SAS, HTML is the only other challenge, no Java required Level of interactivity is different Using HTML Table as Layout: Using HTML Table as Layout eData demonstrated effective use of table cell background colors HTML tables are effective layout for flow diagrams as shown in Trialex dependency diagram HTML Table Layout Tool: HTML Table Layout Tool Nested HTML tables form self contained cells to layout diagrams Dynamic diagrams fit any browserHTML Table Versatility: HTML Table Versatility Used inside Email messages Trialex Update uses email as information delivery Sample HTML Nested Table: Sample HTML Nested Table <table border="1"> <tr> <td>text in table 1<div align="left"> <table border="1"> <tr> <td>table 2 in table 1</td> </tr> </table> </div></td> </tr> </table> Using Java Script: Using Java Script Quick form field selection and validation Add Interactive Navigation Add Pop up Menu InteractivityJava Script Field Selection: Java Script Field Selection Select All button. Non-CGI with Java Script.Java Script Select Button : Java Script Select Button <input name="b_sel" onclick="selAll()" type="button” value="Select All"> function selAll() { toggle = toggle + 1; remainder = toggle % 2; if (remainder == 1) { document.myForm.selit[0].selected = true; . . . } if (remainder == 0) { document.myForm.selit[0].selected = false; . . . } return; } Java Script Navigation: Java Script Navigation Java Script for button to navigate to another location in the same HTML page.Java Script Navigation Code: Java Script Navigation Code <input type="button" value="Options..." name="b_opt" onClick="linkHandler('#Page2')"> function linkHandler(loc){ window.location.href = loc; if (loc=="#Page1") document.myForm.b_ok2.focus(); if (loc=="#Page2") document.myForm.b_back.focus(); return; }Java Script Pop up Menu: Java Script Pop up Menu Clicking on GIF images can pop up a menu Much greater interactivityJava Script Menu Source Sample: Java Script Menu Source Sample <a HREF="javascript:doMenu(’demog', '127923658207','3','127923658218')"> <img src="data.gif" width="4" height="4" border="0"></a> function doMenu(obj,parent,generat,objid) { document.myForm.object.value = obj; document.myForm.parent.value = parent; document.myForm.generat.value = generat; document.myForm.objid.value = objid; window.showMenu(window.jobMenu); return; }Including Show Menu Java Script: Including Show Menu Java Script <script LANGUAGE="JavaScript1.2" SRC="http://myserver/menu.js"></script> /** * Menu 0.8 990602 * by gary smith, July 1997 * Copyright (c) 1997-1999 Netscape * Communications Corp. */ function showMenu(menu, x, y, child) { if (!window.wroteMenu) return; if (document.layers) { ... Java Script is the Glue: Java Script is the Glue Static HTML pages can become interactive with Java Script Java Script is fast and integrates closely with HTML pages It is efficient since no trips to server are required It can link and add communications and interactivity between HTML objects to form the GLUE of HTML pagesUsing email with Internet Applications: Using email with Internet Applications Email used as information delivery Facilitating collaborative tools which enable groups to communicate effectivelyInformation Delivery: Information Delivery In this Trialex example, after a program has been submitted, an email in HTML format is sent with status of submitted SAS job.Collaborative Group Ware: Collaborative Group Ware Adding an email interface to a system can communicate relevant content through email. Email in SAS: Email in SAS Interactive SAS allows email facilitiesEmail with SAS/IntrNet: Email with SAS/IntrNet SAS Interactive dialog boxes are replaced with HTML forms Email facilities are executed with commands in batch SAS can access these through X system commands Many command line email tools are freely available on multiple platforms See more information on WUSS paper titled “SAS Information Delivery with Email and the Internet” Performance and Tuning: Performance and Tuning Decrease the time for user response Users lose interest and are frustrated when it goes on for more than five seconds Some optimization strategies Server Side Client Side Performance and Tuning: Performance and Tuning Splash Screen Establish browser/server connection Place server application onto memory Load Applets to clientsSplash Screen HTML Sample: Splash Screen HTML Sample <body OnLoad="runsubmit()"> <script language="JavaScript"> <!-- Hide function runsubmit () { document.startup.submit(); return; } // --> </script> Optimize SAS Queries: Optimize SAS Queries Use the right tools for the job DATA STEP SCL PROC SQLSpread out Application Load: Spread out Application Load Spread the load to multiple application servers for faster responseMultiple Application Server Configuration: Multiple Application Server Configuration Sample SAS Broker Configuration for multiple SAS application servers onto one machine SocketService default "Reuse existing session" ServiceDescription "Pages reference this generic server when they don't care which service is used." ServiceAdmin "Sy Truong" ServiceAdminMail "sy.truong@meta-x.com" Server myserver.meta-x.com Port 5001 5002 Use of JavaScript: Use of JavaScript Trips to Server adds 1 or 2 seconds depending on connection speeds JavaScript is delivered quickly as small text file and runs on the client Optimal use of both client processing and serverCreate Smaller Applets: Create Smaller Applets Create Java Applets only when necessary Keep them small for faster download timeBatch versus Interactive: Batch versus Interactive For long jobs, send it to batch server For fast shorter jobs, use run interactively and return results right awayHTML Optimization : HTML Optimization Optimize HTML Tables Avoid unnecessary table cells or nested tables Optimize GIFs / JPEG <img src="../images/metax.jpg" width="86" height="80”>Response Time Makes or Breaks: Response Time Makes or Breaks Performance is very significant for user experience It is naturally more productive when optimized This is one of the highest complaints and deserves attention Security: Security Important for intranet but more significant for internet Types of Security Secure Socket Layer Tunneling Session State Control Data Security Email SecuritySecure Socket Layer (SSL): Secure Socket Layer (SSL) Encryption of information from the Web Server and the browser (http) Secure Socket Layer (SSL): Secure Socket Layer (SSL) Socket is network API for communication Most often used to secure http (protocol for web browser) Other protocols such as NNTP, POP3, IMAP, etc.Got SSL?: Got SSL? Free versions available Apache Interface to SSL (http://www.modssl.org/) SSLeay free implementation of Netscape's Secure Socket Layer (http://psych.psy.uq.oz.au/~ftp/Crypto/) Many commercial products available Using SSL: Using SSL Once installed on web server update reference from: http://myserver/cgi-bin/broker.exe to https://myserver/cgi-bin/broker.exe Tunneling: Tunneling Secure communications between web servers and SAS Servers Common Scenario for Java AppletsHow Tunneling Works: How Tunneling Works First Web Browser (Client) loads HTML including Java Classes Applets communicate (i.e SAS/CONNECT) to web server (http) Web Server uses tunneling software Messaging Router (shrcgi) which passes request to SAS server with security by verifying approved web server approved SAS server with valid port approved user with access Using Tunneling: Using Tunneling Install the server programs on web server with configuration to include system information The routerUrl is set as a parameter on the <applet> tag in your HTML file. For example: <param name=routerUrl value="http://yourhost.com/cgi-bin/shrcgi.exe"> Session State Control: Session State Control Web knows no state of time Each session web page is cached on the browser (back button)Adding Session Logic: Adding Session Logic Keep track of user location in a data base Every update of a web page is trackedHTML Session Logic: HTML Session Logic Create a unique identifier for each HTML session Expire old HTML session and require re-login <form name="myForm" action="/cgi-bin/broker.exe"> <input type="hidden" name="_PROGRAM" value="mylib.mycat.myprog.scl"> <input type="hidden" name="_SERVICE" value="default"> <input type="hidden" name="usrname" value="struong"> <input type="hidden" name="session" value="0.570441"> ... Data Level Security : Data Level Security Lock up the data access OS level protection SAS password protects the specified dataSAS Code to Protect Data: SAS Code to Protect Data Sample SAS data step to password protect data Sample SQL code to password protect data data lockdata (pw=apple); set thedata; run; proc sql; create table lockdata (pw=apple) as select * from thedata; run;Email Security: Email Security SSL Applied to POP Server Email Attachments PKZIP with password protection Password Protect SAS Data Email an HTML link and the HTML page is locked Tools Dynamic Levels : Tools Dynamic Levels Degree of Difficulty : Degree of Difficulty Performance: Performance Recommendations for Static Publishing: Recommendations for Static Publishing Quick with limited customization: SAS HTML Formatting Macros Elaborate HTML publications: DATA STEP SCL Code HTML GenerationRecommended for Applications: Recommended for Applications Quick Development with Limited Customization WebAF & EIS predefined objects htmSQL Elaborate Systems Customized webAF for Java applets SAS/IntrNet with JavaScriptUsing Web Technologies Effectively with SAS®: Using Web Technologies Effectively with SAS® Questions? Sy Truong sy.truong@meta-x.com http://www.meta-x.com