Online File

How to use this page


Tech: The Dictionary Page Project

dpage.sas
Program file
Web page sequence for dictionary from alphabetic list


*
  dpage.sas
  Create empty dictionary web pages for Global Statements Dictionary.
  Rick Aster   February 2, 2003
*;
filename alpha 'c:\My Documents\dpage\alpha.txt';

data word;
   infile alpha truncover;
   input @1 letter $char1. @1 prefix $char2.;
   letter = lowcase(letter);
   prefix = lowcase(prefix);
run;
*
  Sort to put list in alphabetical order.
*;
proc sort data=word nodupkey out=page;
   by letter prefix;
run;
*
  This transpose creates variables COL1, COL2, etc. from PREFIX.
  The LETTER dataset links prefixes (aa, ab, etc.) with letter (a).
*;
proc transpose data=page (where=(prefix ne letter))
    out=letter;
   by letter;
   var prefix;
run;
*
  Create a separate HTML file for each dictionary web page.
*;
data _null_;
   length filename $ 64;
   array lp{32} $ 2 col1-col32;
   merge page letter;
   by letter;
   * Read next and previous prefixes for Next and Previous links ;
   if _n_ < n then set page (firstobs=2 keep=prefix rename=(prefix=next))
       nobs=n;
   if _n_ > 1 then set page (keep=prefix rename=(prefix=previous));
   filename = 'c:\My Documents\dpage\' || trim(prefix) || '.html';
   h2 = prefix;
   if letter = prefix then h2 = upcase(h2);
   file out filevar=filename;
   put
       '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"'
       / '"http://www.w3.org/TR/REC-html40/loose.dtd">'
       / '<html>'
       / '<head>'
       / '<title>Global Statements Dictionary: ' prefix : $upcase. +(-1) '</title>'
       / '<meta name="description"'
       / 'content="A computer dictionary for SAS programmers by Rick Aster.">'
       / '<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">'
       / '<link href="../main.css" type="text/css" rel="stylesheet">'
       / '</head>'
       / '<body>'
       // '<div id="page">'
       / '<h1 class="xlogo"><a href="../index.html" id="xlogoblue">Global Statements</a>'
       / '<a href="index.html" id="xlogoblack">Dictionary</a></h1>'
       / '<p class="smallnav">'
       / '<a href="' previous +(-1)'.html">Previous</a> |'
       / '<a href="' next +(-1) '.html">Next</a> |'
       / '<a href="index.html">Index</a>' @;
   *
      Link to main page for letter,
   *;
   if letter ne prefix then put ' |'
       / '<a href="' letter $char1. '.html">' letter $upcase1. '</a>' @;
   put / '</p>' // '<h2>' h2 +(-1) '</h2>';
   *
      Link to secondary pages for letter 
   *;
   if letter = prefix then do;
      put '<p align=center>';
      do i = lbound(lp) to hbound(lp) while (lp{i} ne '');
         put '<a href="' lp{i} +(-1) '.html">' lp{i} +(-1) '</a>';
         end;
      put '</p>';
      end;
   put '<hr>' ///// '<hr>' /
       / '<p class="smallnav">'
       / '<a href="' previous +(-1)'.html">Previous</a> |'
       / '<a href="' next +(-1) '.html">Next</a> |'
       / '<a href="index.html">Index</a>' @;
   if letter ne prefix then put ' |'
       / '<a href="' letter $char1. '.html">' letter $upcase1. '</a>' @;
   put / '</p>' // '</div>' // '</body>' / '</html>';
run;

 O /\

Global
Statements

RICK ASTER

SAS

BOOKS

Tech | Dictionary

Download | Rastinate

Techniques

Projects

Dictionary Page

Also see:

Dictionary

Start Here

Q & A

Rick Aster