The main content (HTML and JavaScript code) is generated directly in the script via a DATA _NULL_ step with inline data (CARDS4 statement). It also uses the '_htcook' environment macro variable to retrieve client cookies, which is an external source provided by the SAS application server.
1 Code Block
DATA STEP
Explanation : This DATA _NULL_ step uses the special output destination '_webout' to begin generating an HTML page. The HTML and JavaScript code, which is read as inline data via the CARDS4 statement, is written directly to the web output stream. The included JavaScript handles user events (clicks, mouse movements) to open and close a pop-up window.
Copied!
data _null_ ;
input ;
file _webout ;
put _infile_ ;
cards4 ;_card_content_;
;;;;
run ;
1
DATA _null_ ;
2
INPUT ;
3
file _webout ;
4
put _infile_ ;
5
cards4 ;_card_content_;
6
;;;;
7
RUN ;
2 Code Block
DATA STEP
Explanation : This second DATA _NULL_ step continues to write to the '_webout' output. It adds a title for a cookie section, decodes and displays the content of the Stored Process macro variable '_htcook' (which contains browser cookies), then closes the HTML tags of the page.
Copied!
data _null_ ;
file _webout ;
put '<h1>Cookies</h1>' ;
htcook=htmldecode("&_htcook") ;
put htcook ;
put '</body>' ;
put '</html>' ;
run ;
1
DATA _null_ ;
2
file _webout ;
3
put '<h1>Cookies</h1>' ;
4
htcook=htmldecode("&_htcook") ;
5
put htcook ;
6
put '</body>' ;
7
put '</html>' ;
8
RUN ;
3 Code Block
Macro
Explanation : The %STPBEGIN and %STPEND macros are markers used by the SAS Stored Processes framework to delimit the code to be executed. The following line of code is a defensive programming technique to ensure proper termination of macro calls in any context.
Copied!
%STPBEGIN;
%STPEND;
*';*"*/;run;
1
%STPBEGIN;
2
%STPEND;
3
*';*"*/;RUN;
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.