/**********************************************************************/
/*    Program:  NONEMP_HTML.SAS                                       */
/*    Written:  October 16, 2001                                      */
/*    Programmer:  Edward Johnson                                     */
/*    User Specifications June 8, 2001 by Jerry Roth                  */
/*    Programmer Specifications               by Edward Johnson       */
/*    Last modifies August 12, 2003 - Rao Katikineni                  */
/*                                                                    */
/**********************************************************************/

/**********************************************************************/
/*   The purpose of this program is to create HTML pages for the      */
/*   Nonemployer publication using the Publication Source file        */
/**********************************************************************/

libname d 'nls_cen19:[ec97.ec97x00.data]'; /*Pub Source Directory*/
libname s 'eap97_prod:[ec97.sharedata]';   /*DDS Shared Direcrory*/


proc copy in=d out=work;
select nonemp01; /*For production change to NONEMP99*/
run;

DATA nonemp01;
set nonemp01 ;
if xtab eq '001' and   /*All types of establishments*/
rtype eq '01';         /*NAICS '01' is for public not BEA */
run;

/*Use PROC SQL to create data sets of geographical areas
for the pull downs.*/

proc sql;

/*Create a dataset of states for each 2 digit NAICS code.
This dataset shows which states have data for each 2 digit code. sector*/

create table stbynaic as
select distinct geotype,st,sector, geo, abbr from nonemp01
where (estabf ne 'D' or ecvaluef ne 'D') and
 xtab eq '001'   and
(geotype = '1' or geotype eq '2');

/*Create a dataset of counties within each state which have data
for each 2 digit NAICS code*/

create table county as
select distinct geotype,st,county, geo, abbr from nonemp01
where (estabf ne 'D' or ecvaluef ne 'D') and
 xtab eq '001' and geotype = '3';

/*Create a dataset of MSA's (US level) which have data
for each 2 digit NAICS code*/

create table msa as
select distinct geotype,msa,geo from nonemp01
where (estabf ne 'D' or ecvaluef ne 'D') and
 geotype eq '6' and
 xtab eq '001' and (pmsa eq '9999' or pmsa eq '0000');

/*Create a dataset of PMSA's within each MSA which have data
for each 2 digit NAICS code*/

create table pmsa as
select distinct geotype,csa,pmsa,geo from nonemp01
where (estabf ne 'D' or ecvaluef ne 'D') and (geotype eq '6') and (xtab eq
'001') and (pmsa ne '9999');

quit;

proc sort data=stbynaic;
by sector st;
run;

proc sort data=county;
by st county;
run;

proc copy in=s out=work;
select msabyst;
run;

proc sort data=msabyst;
by st msa;
run;

proc sort data=msa;
by msa;
run;

proc sort data=pmsa;
by csa pmsa;
run;

/* Convert the SAS Data Set STBYNAIC into a text file which
contains a HTML form which can be
copied into a later HTML file to allow the user to select a specifc state.
These files contain the HTML source for pull downs to show which states have
data for each sector.
This is needed because of the difficulty that SAS has in reading a second
SAS data set while processing a first.*/

data _null_;
length outline $ 150 website $ 44 fname $ 80;
retain fname;
set stbynaic;
by sector st;
if first.sector then
    do;
       fname = 'sys_temp:[ec97.htmlwork]sector' || sector || '.inc';
       file a filevar=fname;
    end;

file a filevar=fname;
if sector eq '00' then
  do;
     website='/epcd/nonemployer/2001/';
     outline = '<option value="' || trim(website) || lowcase(abbr)|| '/' ||
     upcase(abbr) || '000' ||  '.HTM">' || trim(geo) || '</option>';
     put outline;
  end;
else
  do;
     website='/epcd/nonemployer/2001/';
     outline = '<option value="' || trim(website) || lowcase(abbr)|| '/' ||
     upcase(abbr) || '000_' || sector || '.HTM">' || trim(geo) || '</option>';
     put outline;
  end;
run;


/* Convert the SAS Data Set COUNTY into a text file containing a
HTML form which can be
copied into a later HTML file to allow the user to select a specifc county
within a state.
These files contain the HTML source for pull downs to show which counties have
data for each sector.
This is needed because of the difficulty that SAS has in reading a second
SAS data set while processing a first.*/

data _null_;
length outline $ 150 website $ 44 fname $ 80;
retain fname stname;
set county;
by st county;
if first.st then do;
  fname = 'sys_temp:[ec97.htmlwork]state' || st || '.inc';
  file a filevar=fname;
      end;

file a filevar=fname;
website='/epcd/nonemployer/2001/';
outline = '<option value="' || trim(website) || lowcase(abbr) || '/' ||
upcase(abbr) || county || '.HTM">' || trim(geo) || '</option>';
put outline;
run;


/* Convert the SAS Data Set MSABYST into a text file containing a
HTML form which can be
copied into a later HTML file to allow the user to select a specifc
Metropolitan area within a state.
These files contain the HTML source for pull downs to show which metro areas
within each state have data for each sector.
This is needed because of the difficulty that SAS has in reading a second
SAS data set while processing a first.*/

data _null_;
length outline $ 150 website $ 44 fname $ 80;
retain fname;
set msabyst;
by st msa;
if first.st then do;
  fname = 'sys_temp:[ec97.htmlwork]msast' || st || '.inc';
  file a filevar=fname;
      end;

file a filevar=fname;
website='/epcd/nonemployer/2001/';
outline = '<option value="' || trim(website) || 'metro' || substr(msa,1,1) ||
'/M' || msa || '.HTM">' || trim(geo) || '</option>';
put outline;
run;


/* Convert the SAS Data Set MSA into a text file containing a
HTML form which can be
copied into a later HTML file to allow the user to select a specifc
Metro area of the United States.
These files contain the HTML source for pull downs to show which metropolitan
areas have data for each sector.
This is needed because of the difficulty that SAS has in reading a second
SAS data set while processing a first.*/

data _null_;
length outline $ 150 website $ 44 fname $ 80 ;
retain fname;
set msa;
by msa;
if _n_ eq 1 then do;
  fname = 'sys_temp:[ec97.htmlwork]allmsa.inc';
  file a filevar=fname;
      end;

file a filevar=fname;
website='/epcd/nonemployer/2001/';
outline = '<option value="' || trim(website) || 'metro' || substr(msa,1,1)
|| '/M' || msa || '.HTM">' || trim(geo) || '</option>';
put outline;
run;

/* Convert the SAS Data Set PMSA into a text file containing a
HTML form which can be
copied into a later HTML file to allow the user to select a specifc PMSA
within a MSA.
These files contain the HTML source for pull downs to show which PMSA's
within each CSA have data for each sector.
This is needed because of the difficulty that SAS has in reading a second
SAS data set while processing a first.*/

data _null_;
length outline $ 150 website $ 44 fname $ 80;
retain fname;
set PMSA;
by csa pmsa;
if first.csa then do;
  fname = 'sys_temp:[ec97.htmlwork]csa' || csa || '.inc';
  file a filevar=fname;
      end;
file a filevar=fname;
if pmsa ne '0000'  and pmsa ne '9999' then
   do;
      website='/epcd/nonemployer/2001/';
      outline = '<option value="' || trim(website) || 'metro' ||
      substr(pmsa,1,1) || '/M' || pmsa || '.HTM">' || trim(geo) || '</option>';
      put outline;
    end;
run;

proc sort data=nonemp01;
by st county msa pmsa geotype sector naics;
run;

/**************************************************************************/
/*Create a separate HTML page for each state, county, msa, pmsa
sector combination.  Also, write a record to the NAICSUMM dataset
every time the 2 digit naics changes so that a HTML page can be created
showing ALL 2 digit NAICS for each Geographic area. */
/**************************************************************************/

data   naicsumm(drop=line ind_det curdate);
length fname infname allsect $ 50 line $150 ind_det $13 curdate 8 f $ 60 s $ 60
       statenam $ 80 temptext $ 200 dwarrow $ 3 savenaics $ 8 saveind $ 107
       saveest 8 saveestf $1 saveec 8 saveecf $1;

retain fname statenam allsect dwarrow savenaics saveind saveest saveestf
       saveec saveecf;
set nonemp01;
by st county msa pmsa geotype sector naics;

file 'sys_temp:[ec97.htmlwork]nonemp.html';
if sector eq '00' then
      output;
else
  do;
    if first.sector then
     do;
       dname='sys_temp:[ec97.htmlwork]';
       if geotype eq '6' then
         if pmsa ne '0000'  and pmsa ne '9999' then
           do;
              fname = 'metro' || substr(pmsa,1,1) || '/M' || pmsa ||
              '_' || sector || '.HTM';

              allsect =  'M' || pmsa || '.HTM';
           end;
         else
           do;
              fname = 'metro' || substr(msa,1,1) || '/M' || msa ||
              '_' || sector || '.HTM';

              allsect =  'M' || msa || '.HTM';
           end;
       else
        do;

           fname = lowcase(abbr) || '/' || upcase(abbr) || county || '_' ||
           sector || '.HTM';

           allsect =  upcase(abbr) || county || '.HTM';
         end;

     put 'FILE ' fname;
     put '<html>';
     put '<head>';
     put '<!-- Nonemployer HTML originally developed by Paul Zeisset/EPCD-->';
     put '<!-------------------------------July 27, 2001------------------->';
     put '<!-- TITLE DESCRIPTION  -->';
     put '<!--   year  Nonemployer Statistics industry geo -->';
     put '<title>' year '  Nonemployer Statistics -' industry '-' geo;
     put '</title>';
     put '<meta http-equiv="content-type" content="text/html" ';
     put 'charset="iso-8859-1">';
     put '</head>';
     put '<body bgcolor=#ffffff vlink=#66330>';
     put '<a href="http://www.census.gov">';
     put '<img src="http://www.census.gov/main/www/img/cb_head.gif"
     ALT="Link to Census Home Page" border=0></a>';
     put ' ';
     put '<!-- HEADER TABLE  -->';
     put '<table width=100% border=0 cellspacing=1 cellpadding=1>';
     put '<tr> ';
     put '<td valign="top">';
     put '<a href="http://www.census.gov/epcd/nonemployer/"><img
     src="http://www.census.gov/epcd/www/img/nemplogo.jpg"
     ALT="Link to Nonemployer Main Page"></td>';
     put '<td align=left valign="top"><font size=+2><b>';
     put '<!-- PUBLICATION INFORMATION CELL -->';
     put '<!-- Nonemployer Statistics, year -->';
     temptext= 'Nonemployer Statistics, ' || year ||'<br>';
     put temptext;
     put '<!-- industry with Initial Caps-->';
     temptext= trim(heading) || ' <br>';
     put temptext;
     put '<!-- geo -->';
     put geo '</b></font></td>';
     put '<!-- END PUBLICATION INFORMATION CELL -->';
     put ' ';

/*create yfile for the link */
noabbr = scan (fname, -1, "/");
abbrlen = length(trim(noabbr));
yfile = substr(noabbr,1, abbrlen-4);

     put '<!-- FORM PULLDOWN TO PICK YEAR -->';
     put '<td align=left valign=bottom> ';
     put '<form action="http://www.census.gov/cgi-bin/geo/location"';
     put 'method="post">';
     put '<font size=1 face=arial, helvetica, sans-serif>';
     put '<select name="Location">';

/*year on the top of pull down menu*/
put '<option value=';
ttext='"http://www.census.gov/epcd/nonemployer/2001/'|| trim(fname) ||'">';
     put ttext;     
     put '2001</option>';

     put '<option value=';
ttext='"http://www.census.gov/epcd/nonemployer/2001/'|| trim(fname) ||'">';
     put ttext;     
     put '----</option>';
   /****************/
fnamelen = length(trim(fname));
ffile = substr(fname,1, fnamelen-4);

/*use Paul's year pull down*/
/*inclue inc file for year pull down in detail page=ydp*/
ypdtxt =  '<!--#include virtual="'||'/epcd/nonemployer/include/' ||
trim(ffile) || '.INC' ||'"-->';
put ypdtxt;

     put '</select>';
     put '<input value="GO" type="submit" name="submit">';
     put '</font> ';
     put '</form>';
     put '</td>';
     put '<!-- END FORM PULLDOWN TO PICK YEAR -->';
     put ' ';
     put '<td align="right" valign="bottom"> ';

     put '<!-- FORM PULLDOWN TO PICK STATE -->';
     put '<form action="http://www.census.gov/cgi-bin/geo/location" ';
     put 'method="post">';
     put '<font size=1 face=arial, helvetica, sans-serif>  ';
     put '<select name="Location">';
     put '<option value=" ">Select a State</option>';

/*Include files for pulldown*/
temptxt = '<!--#include virtual="'||'/epcd/nonemployer/2001/sector'
                                  || sector || '.inc' ||'"-->';
put temptxt;

     put '</select>';
     put '<input value="GO" type="submit" name="submit">';
     put '</font> ';
     put '</form>';
     put '<!-- END FORM PULLDOWN TO PICK STATE -->';

    /* If this is a state or county page, add a pull down for counties in the
    state and for the metropolitan areas within the state */
if geotype eq '2' then statenam = geo;
if geotype eq '2'  or geotype eq '3' then
do;
 put '<!-- FORM PULLDOWN TO PICK COUNTIES -->';
 put '<form action="http://www.census.gov/cgi-bin/geo/location"';
 put 'method="post">';
 put '<font size=1 face=arial, helvetica, sans-serif>  ';
 temptext= '<select name="Location"> <option value=" ">' ||
 trim(statenam) || ' Counties</option>';
 put temptext;

/*Counties by state*/
/*Include files for pulldown*/
temptxt = '<!--#include virtual="'||'/epcd/nonemployer/2001/state'
                                  || st || '.inc' ||'"-->';
put temptxt;

 put '</select>';
 put '<input value="GO" type="submit" name="submit">';
 put '</font> ';
 put '</form>';
 put '<!-- END FORM PULLDOWN TO PICK COUNTIES -->';
end; /* if geotype eq '2'  or geotype eq '3' */

 /*all metro areas in US*/
if geotype eq '1' or geotype eq '6' then
do;
 put '<!-- FORM PULLDOWN TO PICK ALL METRO AREAS IN US -->';
 put '<form action="http://www.census.gov/cgi-bin/geo/location"';
 put ' method="post">';
 put '<font size=1 face=arial, helvetica, sans-serif>  ';
 temptext= '<select name="Location"> <option value=" ">' ||
 'Select a Metro Area</option>';
 put temptext;

 /*Include files for pulldown*/
temptxt = '<!--#include virtual="'|| '/epcd/nonemployer/2001/allmsa'
                                  || '.inc' ||'"-->';
put temptxt;

 put '</select>';
 put '<input value="GO" type="submit" name="submit">';
 put '</font> ';
 put '</form>';
 put '<!-- END FORM PULLDOWN TO PICK ALL METRO AREAS IN US -->';
end;/*If geotype eq '1' or geotype eq '6'  */
if geotype eq '2' or geotype eq '3' then
do;
  put '<!-- FORM PULLDOWN TO PICK METRO AREAS BY STATE -->';
  put '<form action="http://www.census.gov/cgi-bin/geo/location" ';
  put 'method="post">';
  put '<font size=1 face=arial, helvetica, sans-serif>  ';
  temptext='<select name="Location"> <option value=" ">' || trim(statenam) || '
  Metropolitan Areas</option> ';
  put temptext;


/*Metro areas by state*/
/*Include files for pulldown*/
temptxt = '<!--#include virtual="'|| '/epcd/nonemployer/2001/msast'
                                  || st || '.inc' ||'"-->';
put temptxt;

  put '</select>';
  put '<input value="GO" type="submit" name="submit">';
  put '</font> ';
  put '</form>';
  put '<!-- END FORM PULLDOWN TO PICK METRO AREAS BY STATE -->';
  put ' ';
end;
/*metro areas with PMSAs */
if csa ne '00' and csa ne '99' then
do;
 put '<!-- FORM PULLDOWN TO PICK METRO AREAS WITH PMSAs -->';
 put '<form action="http://www.census.gov/cgi-bin/geo/location"
method="post">';
 put '<font size=1 face=arial, helvetica, sans-serif>  ';
 temptext= '<select name="Location"> <option value=" ">' ||
   'Select a PMSA within this CMSA</option>';
 put temptext;


/*Include files for pulldown*/
temptxt = '<!--#include virtual="'|| '/epcd/nonemployer/2001/csa'
                                  || csa || '.inc' ||'"-->';
put temptxt;

 put '</select>';
 put '<input value="GO" type="submit" name="submit">';
 put '</font> ';
 put '</form>';
 put '<!-- END FORM PULLDOWN TO PICK ALL METRO AREAS WITH PMSAs -->';
end;/*If csa ne '00' and csa ne '99'  */
put ' ';
put '</td>';
put ' ';
put '</tr>';
put '</table>';
put '<!-- END HEADER TABLE  -->';

/* create the table heading for the actual data */
put '<p><img src="http://www.census.gov/epcd/www/img/lineb3a.gif"
ALT=""></p>';
put ' ';

put '<font size="-1">Includes only firms subject to federal income tax.  ';
put 'Nonemployers are businesses with no paid employees.';
put '<a href="http://www.census.gov/epcd/nonemployer/view/intro.html">';
put 'Introductory text</a> includes scope and methodology.';

/**************************************************************/
/*put the text below in red to warn the users about New Mexico data*/

put '</font>';  /*close for text above*/
if st = '35' or msa = "0200" or msa = "4100" or msa = "7490" then
  do;
put '<font size="-1" color="red"> The data year 2000 totals for New Mexico';
put 'were considerably lower than data year 1999 and 2001 totals.';
put ' This may be due to incomplete source data or errors  ';
put ' in the data processing system that could not be detected. ';
  end;
put '</font>';

put '<font size="-1">';  /*open for text below*/
/************************************************************/
put 'For descriptions of column headings and rows (industries), ';
put 'click on the appropriate underlined element in the table.</font><br>';

put '<!-- DATA TABLE -->';
put '<table border=0 cellspacing=1 cellpadding=2 width="100%">';
put ' ';

put '<!-- HEADER ROW FOR THE DATA TABLE -->';
put '<tr>';
put '<th align="center" bgcolor="#cccccc" rowspan="2" align="top">';
put '<font size="-1" face="arial">';
put 'NAICS<br>Code';
put '</th>';
put ' ';
put '<th align="center" bgcolor="#cccccc" rowspan="2" align="top">';
put '<font size="-1" face="arial">';
put 'Description';
put '</th>';
put ' ';
put '<th align="center" bgcolor="#cccccc" colspan="2"><font size="-1"
face="arial">';

put '<a href="http://www.census.gov/epcd/nonemployer/nonempdf.htm#nonemployers">
Nonemployers</a>';
put '</th>';
put '</tr>';
put ' ';
put '<tr>';

put '<th align="right" bgcolor="#cccccc"><font size="-1" face="arial">';
put '<a href="http://www.census.gov/epcd/nonemployer/nonempdf.htm#estabs">
Establish-<br>ments</a>';
put '</th>';
put ' ';

put '<th align="right" bgcolor="#cccccc"><font size="-1" face="arial">';
put '<a href="http://www.census.gov/epcd/nonemployer/nonempdf.htm#receipts">
Receipts<br>($1,000)</a>';
put '</th>';

put '</tr>';
put '<!-- END HEADER ROW FOR THE DATA TABLE -->';
put ' ';

/*dwarrow = 'no';  */
 /*set dwarrow to 'no' for every record of the sector*/

/*Assign these retained variables to value of naics, industry, estab*/
/*estabf, ecvalue, and ecvaluef */
savenaics = naics;
saveind = industry;
saveest = estab;
saveestf = estabf;
saveec = ecvalue;
saveecf = ecvaluef;

end;   /*If first.sector*/
/*this is done for every record*/

/* If there are data in every record of the detail pages*/
/*then display the arrow*/
/*if estab ne 0 or ecvalue ne 0 then */
/*     do;             */
/*        dwarrow ='yes';*/
/*     end;    */

ind_det = lowcase(abbr) || '/' || upcase(abbr) || county || '_' ||
          sector || '.HTM>';

put '<!-- DATA ROWS -->';
put '<tr>';
/* Code to supress duplicate lines in HTML output. */
/* This will occur only on the Sector specific pages; */
/* the first pages created by the SAS program. */
/* These variables are created and retained to hold */
/* the values of naics, industry, estab, and ecvalue */
/* from one pass to the next in the data step. */
retain prevnaics prevind prevest preveval;

if (naics eq prevnaics) and (industry eq prevind) and (estab eq prevest) and
(ecvalue eq preveval) then
   do;
     put _all_; /* suppress this data line to the log */
   end;
else /* write data out */
do;

  nl = length(trim(naics));
  dash = substr(left(naics),3,1);

  if (dash eq '-') or (nl eq 2) or (nl eq 3) then
    do;
        boldtxt =  '<b>';
    end;
  else
    do;
         boldtxt = '';
    end;

put '<!-- naics -->';
put '<td bgcolor="#eeeeee"><font size="-1" face="arial">';
put boldtxt;
put naics;
put '</font></td>';
put ' ';

put '<!-- naics definition -->';
put '<td bgcolor="#eeeeee"><font size="-1" face="arial">';
put boldtxt;
line = '<a href="http://www.census.gov/epcd/ec97/def/' || trim(naics) ||
'.HTM">';
put line;

put industry;
put '</a></font></td>';
put ' ';

put '<!-- establishment -->';
put '<td align=right bgcolor="#dddddd"><font size="-1" face="arial">';
put boldtxt;
if estabf ne ' ' then
 do;
  put estabf;
 end;
else
 do;
  put estab comma12.;
 end;
put '</font></td>';
put ' ';

put '<!-- receipts -->';
put '<td align=right bgcolor="#dddddd"><font size="-1" face="arial">';
put boldtxt;
if ecvaluef ne ' ' then
 do;
  put ecvaluef;
 end;
else
 do;
  put ecvalue comma12.;
 end;

if (dash eq '-') or (nl eq 2) or (nl eq 3) then
    do;
        put '</b>';
    end;

end;
/* (naics eq prevnaics)(industry eq prevind)(estab eq prevest)(ecvalue eq
preveval) */

/* reset the variables to check for duplicate lines */
a="1";
prevnaics=naics||trim(a);
prevind=industry;
prevest=estab;
preveval=ecvalue;

put '</font></td>';
put '</tr>';
put '<!-- END DATA ROWS -->';
if last.sector then
 do;

/* Set value of naics, industry, estab, estabf, ecvalue, and ecvaluef*/
/*to these retained variables in first sector */
naics = savenaics;
industry = saveind;
estab = saveest;
estabf = saveestf;
ecvalue = saveec;
ecvaluef = saveecf;
output;
   put '</table>';
   put '<!-- END DATA TABLE -->';
   put ' ';
   put '<font size="-1"><b>D</b> Withheld to avoid disclosure;';
   put '<b>S</b> Withheld because data do not meet publication standards;';
   put '</font>';
   put ' ';
   put '<br>';

/*****************************************************************************/
/*   Jenny Hua modified the footer of HTML pages on 11/28/01                 */
/*   Create tables for the footer. The footer includes several               */
/*   hyperlinks.  The links contain data in different formats, Nonemployer   */
/*   Statistic, Census 2000, Search Engine, Data Access Tools, etc.          */
/*   In additional to these hyperlinks, the HTML footer also displays        */
/*   the date page generated, and an email for responsed to any question     */
/*   from users.                                                             */
/*****************************************************************************/

   put '<table width="100%">';
   put '<tr>';
   put '<td align="center" bgcolor="eeeeee" width="20%"><a href="#_top">Top</a>
        </td>';

   put '<td align="center" bgcolor="EEEEEE" width="20%">
   <a href='//allsect//' > All-sector table</a></td>';

   put '<td align="center" bgcolor="eeeeee" width="30%">
   <a href="http://www.census.gov/pub/epcd/nonemployer/download/ndownload.html">
    Data in formats for downloading</a>';
   put '</td>';
   put '<td align="center" bgcolor="eeeeee" width="30%">';

   put '<table>';
   put '<tr>';
   put '<td><a href="http://www.census.gov/prod/www/abs/nonemp.html">
     Publication (page images)<font size=-1> (U.S. and state data only)
     </font></a>';
   put '</td>';
   put '<td><a href="http://www.census.gov/prod/www/abs/nonemp.html">
       <img src="http://www.census.gov/main/www/img/pdficon.gif"
         alt="pdf" border="0">';
   put '</td>';
   put '</tr>';
   put '</table>';
   put '</td>';
   put '</tr>';
   put '</table>';
   put '</font>';
   put '<br>';
   put '<strong>Source:</strong>
      <a href="http://www.census.gov/epcd/nonemployer/">Nonemployer
          Statistics</a>';

   put '<br>';
   curdate=today();
   put '<p>Page Generated ' curdate worddate18. ;
   put '&nbsp;';

if substr(fname,1,5) ne 'metro' then
   do;
       mailto =
'<a href="mailto:epcd.nonemployer.statistics@census.gov?subject=nonemployer:';
       mailq = trim(mailto) || substr(fname,4,8) ||'">Questions?</a>';
       put mailq;
   end;

if substr(fname,1,5) eq 'metro' then
    do;
       mailto =
'<a href="mailto:epcd.nonemployer.statistics@census.gov?subject=nonemployer:';
       mailq = trim(mailto) || substr(fname,8,8) ||'">Questions?</a>';
       put mailq;
    end;

   put '<br>';
   put '<center>';
   put '<font face="helvetica" size="1">';
   put '<br>';
   put '<a href="http://www.census.gov/dmd/www/2khome.htm">Census 2000</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/subjects.html"
        target="_top">Subjects A to Z</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/srchtool.html"
        target="_top">Search</a>';
   put '&nbsp;|&nbsp;<a href="https://catalog.mso.census.gov/esales4boc"
        target="_top">Product Catalog</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/access.html"
       target="_top">Data Access Tools</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/po/www/foia/foiaweb.htm">
       FOIA</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/policies.html"
       target="_top">Privacy &#183; Policies</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/contacts.html"
       target="_top">Contact Us</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/index.html"
       target="_top">Home</a>';
   put '<br><img src="http://www.census.gov/main/www/img/home/blue_pix2.gif"
       alt=" " width=630 height=2>';
   put '<br><img src="http://www.census.gov/main/www/img/wordmarktl.gif"
       alt="U.S. Census Bureau:Helping You Make Informed Decisions">';
   put '</font>';
   put '</center>';
   put '<a name="skip"></a>';
   put '<p>';
   put '<!-- End tables for the footer -->';
   put '</body>';
   put '</html>';
end; /*If last sector*/
end; /*if sector ne '00'*/
run;









proc sort data=naicsumm;
by st county msa pmsa geotype sector naics;
run;

data _null_;
length fname infname $50 line $150 ind_det $13 curdate 8 f $ 60 s $ 60
       statenam $ 80 temptext $ 200;
retain fname statenam;
set naicsumm;
by st county msa pmsa geotype sector naics;
file 'sys_temp:[ec97.htmlwork]nonemp.html' mod;
if first.pmsa then  do;
    dname = 'sys_temp:[ec97.htmlwork]';
    if geotype eq '6' then
      if pmsa ne '0000'  and pmsa ne '9999' then
          fname= 'metro' || substr(pmsa,1,1) || '/M' || pmsa || '.HTM';
        else
          fname= 'metro' || substr(msa,1,1) || '/M' || msa || '.HTM';

        else
          fname= lowcase(abbr) || '/' || upcase(abbr) || county || '.HTM';
     put 'FILE ' fname;
     put '<html>';
     put '<head>';
     put '<!-- Nonemployer HTML originally developed by Paul Zeisset/EPCD-->';
     put '<!-------------------------------July 27, 2001------------------->';
     put '<!-- TITLE DESCRIPTION  -->';
     put '<!--   year  Nonemployer Statistics industry geo -->';
     put '<title>' year '  Nonemployer Statistics -' industry '-' geo;
     put '</title>';
     put '<meta http-equiv="content-type" content="text/html" ';
     put 'charset="iso-8859-1">';
     put '</head>';
     put '<body bgcolor=#ffffff vlink=#66330>';
     put '<a href="http://www.census.gov">';
     put '<img src="http://www.census.gov/main/www/img/cb_head.gif"
     ALT="Link to Census Home Page" border=0></a>';
     put ' ';
     put '<!-- HEADER TABLE  -->';
     put '<table width=100% border=0 cellspacing=1 cellpadding=1>';
     put '<tr> ';
     put '<td valign="top">';
     put '<a href="http://www.census.gov/epcd/nonemployer/"><img
     src="http://www.census.gov/epcd/www/img/nemplogo.jpg"
     ALT="Link to Nonemployer Main Page"></td>';
     put '<td align=left valign="top"><font size=+2><b>';
     put '<!-- PUBLICATION INFORMATION CELL -->';
     put '<!-- Nonemployer Statistics, year -->';
     temptext= 'Nonemployer Statistics, ' || year ||' <br>';
     put temptext;
     put '<!-- industry -->';
     temptext= trim(heading) || ' <br>';
     put temptext;
     put '<!-- geo -->';
     put geo '</b></font></td>';
     put '<!-- END PUBLICATION INFORMATION CELL -->';

/*create yfile for the link*/
noabbr = scan (fname, -1, "/");
abbrlen = length(trim(noabbr));
yfile = substr(noabbr,1, abbrlen-4);

     put ' ';
     put '<!-- FORM PULLDOWN TO PICK YEAR -->';
     put '<td align=left valign=bottom> ';
     put '<form action="http://www.census.gov/cgi-bin/geo/location"';
     put 'method="post">';
     put '<font size=1 face=arial, helvetica, sans-serif>';
     put '<select name="Location">';

/*year on the top of pull down menu*/
put '<option value=';
ttext='"http://www.census.gov/epcd/nonemployer/2001/'|| trim(fname) ||'">';
     put ttext;     
     put '2001</option>';

     put '<option value=';
ttext='"http://www.census.gov/epcd/nonemployer/2001/'|| trim(fname) ||'">';
     put ttext;     
     put '----</option>';
   /****************/
fnamelen = length(trim(fname));
ffile = substr(fname,1, fnamelen-4);

/*use Paul's year pull down*/
/*inclue inc file for year pull down in detail page=ydp*/
ypdtxt =  '<!--#include virtual="'||'/epcd/nonemployer/include/' ||
trim(ffile) || '.INC' ||'"-->';
put ypdtxt;

     put '</select>';
     put '<input value="GO" type="submit" name="submit">';
     put '</font> ';
     put '</form>';
     put '</td>';
     put '<!-- END FORM PULLDOWN TO PICK YEAR -->';
     put ' ';
     put '<td align="right" valign="bottom"> ';

     put '<!-- FORM PULLDOWN TO PICK STATE -->';
     put '<form action="http://www.census.gov/cgi-bin/geo/location" ';
     put 'method="post">';
     put '<font size=1 face=arial, helvetica, sans-serif>  ';
     put '<select name="Location">';
     put '<option value=" ">Select a State</option>';

/*Include files for pulldown*/
temptxt = '<!--#include virtual="'|| '/epcd/nonemployer/2001/sector'
                                  || sector || '.inc' ||'"-->';
put temptxt;

     put '</select>';
     put '<input value="GO" type="submit" name="submit">';
     put '</font> ';
     put '</form>';
     put '<!-- END FORM PULLDOWN TO PICK STATE -->';

    /* If this is a state or county page, add a pull down for counties in the
    state and for the metropolitan areas within the state */
if geotype eq '2' then statenam = geo;
if geotype eq '2'  or geotype eq '3' then
do;
 put '<!-- FORM PULLDOWN TO PICK COUNTIES -->';
 put '<form action="http://www.census.gov/cgi-bin/geo/location"';
 put 'method="post">';
 put '<font size=1 face=arial, helvetica, sans-serif>  ';
 temptext= '<select name="Location"> <option value=" ">' ||
 trim(statenam) || ' Counties</option>';
 put temptext;

           /*Counties by state*/
 /*Include files for pulldown*/
temptxt = '<!--#include virtual="'|| '/epcd/nonemployer/2001/state'
                                  || st || '.inc' ||'"-->';
put temptxt;

 put '</select>';
 put '<input value="GO" type="submit" name="submit">';
 put '</font> ';
 put '</form>';
 put '<!-- END FORM PULLDOWN TO PICK COUNTIES -->';
end; /* if geotype eq '2'  or geotype eq '3' */

 /*all metro areas in US*/
if geotype eq '1' or geotype eq '6' then
do;
 put '<!-- FORM PULLDOWN TO PICK ALL METRO AREAS IN US -->';
 put '<form action="http://www.census.gov/cgi-bin/geo/location"';
 put ' method="post">';
 put '<font size=1 face=arial, helvetica, sans-serif>  ';

 temptext= '<select name="Location"> <option value=" ">' ||
 'Select a Metro Area</option>';
 put temptext;
 infname = 'sys_temp:[ec97.htmlwork]allmsa.txt';

/*Include files for pulldown*/
temptxt = '<!--#include virtual="'|| '/epcd/nonemployer/2001/allmsa'
                                  || '.inc' ||'"-->';
put temptxt;

 put '</select>';
 put '<input value="GO" type="submit" name="submit">';
 put '</font> ';
 put '</form>';
 put '<!-- END FORM PULLDOWN TO PICK ALL METRO AREAS IN US -->';
end;/*If geotype eq '1' or geotype eq '6'  */

if geotype eq '2' or geotype eq '3' then do;
  put '<!-- FORM PULLDOWN TO PICK METRO AREAS BY STATE -->';
  put '<form action="http://www.census.gov/cgi-bin/geo/location" ';
  put 'method="post">';
  put '<font size=1 face=arial, helvetica, sans-serif>  ';
  temptext='<select name="Location"> <option value=" ">' || trim(statenam) || '
  Metropolitan Areas</option> ';
  put temptext;


         /*Metro areas by state*/
/*Include files for pulldown*/
temptxt = '<!--#include virtual="'|| '/epcd/nonemployer/2001/msast'
                                  || st || '.inc' ||'"-->';
put temptxt;

  put '</select>';
  put '<input value="GO" type="submit" name="submit">';
  put '</font> ';
  put '</form>';
  put '<!-- END FORM PULLDOWN TO PICK METRO AREAS BY STATE -->';
  put ' ';
  end;
/*metro areas with PMSAs */
if csa ne '00' and csa ne '99' then
do;
 put '<!-- FORM PULLDOWN TO PICK METRO AREAS WITH PMSAs -->';
 put '<form action="http://www.census.gov/cgi-bin/geo/location"
method="post">';
 put '<font size=1 face=arial, helvetica, sans-serif>  ';
 temptext= '<select name="Location"> <option value=" ">' ||
   'Select a PMSA within this CMSA</option>';
 put temptext;


/*Include files for pulldown*/
temptxt = '<!--#include virtual="'|| '/epcd/nonemployer/2001/csa'
                                  || csa || '.inc' ||'"-->';
put temptxt;

 put '</select>';
 put '<input value="GO" type="submit" name="submit">';
 put '</font> ';
 put '</form>';
 put '<!-- END FORM PULLDOWN TO PICK ALL METRO AREAS WITH PMSAs -->';
end;/*If csa ne '00' and csa ne '99'  */
put ' ';
put '</td>';
put ' ';
put '</tr>';
put '</table>';
put '<!-- END HEADER TABLE  -->';

/* create the table heading for the actual data */
put '<p><img src="http://www.census.gov/epcd/www/img/lineb3a.gif"
ALT=""></p>';
put ' ';
put '<font size="-1">Includes only firms subject to federal income tax.  ';
put 'Nonemployers are businesses with no paid employees.';
put '<a href="http://www.census.gov/epcd/nonemployer/view/intro.html">';
put 'Introductory text</a> includes scope and methodology.';

/**************************************************************/
/*put the text below in red to warn the users about New Mexico data*/

put '</font>';  /*close for text above*/

if st = '35' or msa = "0200" or msa = "4100" or msa = "7490" then
  do;
put '<font size="-1" color="red"> The data year 2000 totals for New Mexico';
put 'were considerably lower than data year 1999 and 2001 totals.';
put ' This may be due to incomplete source data or errors  ';
put ' in the data processing system that could not be detected. ';
  end;
put '</font>';

put '<font size="-1">';  /*open for text below*/
/************************************************************/
put 'For descriptions of column headings and rows (industries), ';
put 'click on the appropriate underlined element in the table.</font><br>';

put '<!-- DATA TABLE -->';
put '<table border=0 cellspacing=1 cellpadding=2 width="100%">';
put ' ';

put '<!-- HEADER ROW FOR THE DATA TABLE -->';
put '<tr>';
put '<th rowspan="2" bgcolor="cccccc">'
     '<font size="-1" face="Arial">More<br>data</th>';
put '<th align="center" bgcolor="#cccccc" rowspan="2" align="top">';
put '<font size="-1" face="arial">';
put 'NAICS<br>Code';
put '</th>';
put ' ';
put '<th align="center" bgcolor="#cccccc" rowspan="2" align="top">
<font size="-1" face="arial">';
put 'Description';
put '</th>';
put ' ';
put '<th align="center" bgcolor="#cccccc" colspan="2"><font size="-1"
face="arial">';
put '<a href="http://www.census.gov/epcd/nonemployer/nonempdf.htm#nonemployers">
Nonemployers</a>';
put '</th>';
put '</tr>';
put ' ';
put '<tr>';
put '<th align="right" bgcolor="#cccccc"><font size="-1" face="arial">';
put '<a href="http://www.census.gov/epcd/nonemployer/nonempdf.htm#estabs">
Establish-<br>ments</a>';
put '</th>';
put ' ';
put '<th align="right" bgcolor="#cccccc"><font size="-1" face="arial">';
put '<a href="http://www.census.gov/epcd/nonemployer/nonempdf.htm#receipts">
Receipts<br>($1,000)</a>';
put '</th>';
put '</tr>';
put '<!-- END HEADER ROW FOR THE DATA TABLE -->';
put ' ';

output;

 end;/*first.pmsa*/

/*this is done for every record*/
ind_det = lowcase(abbr) || '/' || upcase(abbr) || county || '_' ||
          sector || '.HTM>';

put '<!-- DATA ROWS -->';
put '<tr>';
if geotype eq '6' then
      if pmsa ne '0000'  and pmsa ne '9999' then
          temptext= '<a href= M' || pmsa || '_' || sector || '.HTM>';
      else
          temptext= '<a href= M' || msa || '_' || sector || '.HTM>';
else
temptext='<a href=' || upcase(abbr) ||county || '_' || sector || '.HTM>';

if sector ne '00' and
(estab ne 0 or ecvalue ne 0 or estabf eq 'D' or ecvaluef eq 'D') then do;

/* create down arrow if additional detail is available*/
  put '<td align="center">' temptext;
  put '<img src="http://www.census.gov/epcd/www/img/arrowdw3.gif"';
  put 'alt= "more data for ';
  temptext= trim(industry);
  put temptext;
  put ' " border="0"></a></td>';
  end;
else put '<td></td>'; /*There is no "more" for sector '00' so create
                        empty table cell*/
put '<!-- naics -->';
put '<td bgcolor="#eeeeee"><font size="-1" face="arial">';
put naics;
put '</font></td>';
put ' ';

put '<!-- naics definition -->';
put '<td bgcolor="#eeeeee"><font size="-1" face="arial">';
line = '<a href="http://www.census.gov/epcd/ec97/def/' || trim(naics) ||
'.HTM">';
put line;
put industry;
put '</a></font></td>';
put ' ';

put '<!-- establishment -->';
put '<td align=right bgcolor="#dddddd"><font size="-1" face="arial">';
if estabf ne ' ' then
 do;
  put estabf;
 end;
else
 do;
  put estab comma12.;
 end;
put '</font></td>';
put ' ';

put '<!-- receipts -->';
put '<td align=right bgcolor="#dddddd"><font size="-1" face="arial">';
if ecvaluef ne ' ' then
 do;
  put ecvaluef;
 end;
else
 do;
  put ecvalue comma12.;
 end;

put '</font></td>';
put '</tr>';
put '<!-- END DATA ROWS -->';
if last.pmsa then
 do;

   put '</table>';
   put '<!-- END DATA TABLE -->';
   put ' ';
   put '<font size="-1"><b>D</b> Withheld to avoid disclosure;';
   put '<b>S</b> Withheld because data do not meet publication standards;';
   put '</font>';
   put ' ';
   put '<br>';

/*****************************************************************************/
/*   Jenny Hua modified the footer of HTML pages on 11/28/01                 */
/*   Create tables for the footer. The footer includes several               */
/*   hyperlinks.  The links contain data in different formats, Nonemployer   */
/*   Statistic, Census 2000, Search Engine, Data Access Tools, etc.          */
/*   In additional to these hyperlinks, the HTML footer also displays        */
/*   the date page generated, and an email for responsed to any question     */
/*   from users.                                                             */
/*****************************************************************************/

   put '<table width="100%">';
   put '<tr>';
   put '<td align="center" bgcolor="eeeeee" width="20%"><a href="#_top">Top</a>
       </td>';
   put '<td align="center" bgcolor="eeeeee" width="30%">
   <a href="http://www.census.gov/pub/epcd/nonemployer/download/ndownload.html">
    Data in formats for downloading</a>';
   put '</td>';
   put '<td align="center" bgcolor="eeeeee" width="30%">';
   put '<table>';
   put '<tr>';
   put '<td><a href="http://www.census.gov/prod/www/abs/nonemp.html">
  Publication (page images)<font size=-1>(U.S. and state data only)</font></a>';
   put '</td>';
   put '<td><a href="http://www.census.gov/prod/www/abs/nonemp.html"><img
   src="http://www.census.gov/main/www/img/pdficon.gif" alt="pdf" border="0">';
   put '</td>';
   put '</tr>';
   put '</table>';
   put '</td>';
   put '</tr>';
   put '</table>';
   put '</font>';
   put '<br>';
   put '<strong>Source:</strong>
     <a href="http://www.census.gov/epcd/nonemployer/"> Nonemployer
           Statistics</a>';
   
   put '<br>';
   curdate=today();
   put '<p>Page Generated ' curdate worddate18.;
   put '&nbsp;';

if substr(fname,10,2) = '81' then
    do;
       mailto =
'<a href="mailto:epcd.nonemployer.statistics@census.gov?subject=nonemployer:';
 mailq = trim(mailto) || substr(fname,4,5) || '00' ||'">Questions?</a>';
       put mailq;
    end;

if substr(fname,14,2) = '81' then
    do;
       mailto =
'<a href="mailto:epcd.nonemployer.statistics@census.gov?subject=nonemployer:';
 mailq = trim(mailto) || substr(fname,8,5) || '00' ||'">Questions?</a>';
       put mailq;
    end;

   put '<br>';
   put '<center>';
   put '<font face="helvetica" size="1">';
   put '<br>';
   put '<a href="http://www.census.gov/dmd/www/2khome.htm">Census 2000</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/subjects.html"
           target="_top">Subjects A to Z</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/srchtool.html"
          target="_top">Search</a>';
   put '&nbsp;|&nbsp;<a href="https://catalog.mso.census.gov/esales4boc"
       target="_top">Product Catalog</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/access.html"
       target="_top">Data Access Tools</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/po/www/foia/foiaweb.htm">
       FOIA</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/policies.html"
       target="_top">Privacy &#183; Policies</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/main/www/contacts.html"
       target="_top">Contact Us</a>';
   put '&nbsp;|&nbsp; <a href="http://www.census.gov/index.html"
       target="_top">Home</a>';
   put '<br><img src="http://www.census.gov/main/www/img/home/blue_pix2.gif"
       alt=" " width=630 height=2>';
   put '<br><img src="http://www.census.gov/main/www/img/wordmarktl.gif"
       alt="U.S. Census Bureau:Helping you make informed decisions">';
   put '</font>';
   put '</center>';
   put '<a name="skip"></a>';
   put '<p>';
   put '<!-- End tables for the footer.-->';
   put '</body>';
   put '</html>';
end;
run;

/*create inc file for year pull down in detail page and summary page*/
/*elimated duplicate value in sector 81*/

/*************************************************************************/
/** Rao Katikinenei : Modification on July 25, 2003 disbaling code below */
/** due to malfunctioning only one row is being returned                 */
/** **********************************************************************/

/* proc sql; */
/* create table ypddata as */
/* select distinct fname,allsect from naicsumm */
/* quit; */

/* alternate code below */
proc sort data=naicsumm out=ypddata nodupkey;
by fname allsect;
run;  
  

/*create dataset named ypddata to include year pull down*/

data ypddata;            /*new dataset to create year pull down*/
set ypddata;
if fname = " " then delete;  /*first obs is blank then delete*/
   yfile = scan (fname, -1, "/");    /*MD000_11.HTM*/
   stfile = scan(fname, 1, "/");     /*md*/
run;

proc sort data=ypddata;    /*sort by MD000_11.HTM, MD000_21.HTM*/
by yfile;
run;

/*create inc file for year pull down for detail pages*/
data _null_;
length yinc $ 150 website $ 44 ytext $ 85;
retain ytext;
set ypddata;
by yfile;
/* open new consolidated file to hold all ypd*.inc files */

file 'sys_temp:[ec97.htmlwork]nonempypd.inc';

ylength = length(trim(yfile));  /*MD000_11.HTM = length of fname*/
yfile = substr(yfile,1,ylength-4);   /*MD000_11 = take out .htm*/

/*************************************************************************/
/** Rao Katikinenei : Modification on July 29, 2003 disabling code below */
/** and write all ypd*.inc to a single file                              */
/** **********************************************************************/

/*example inc file locates in sys_temp:[ec97.htmlwork]ydpMD000_11.inc
ydp stands for year in detail page*/

/* do; */

/*     ytext = 'sys_temp:[ec97.htmlwork]ydp' || trim(yfile) || '.inc'; */

/*     file a filevar=ytext; */
/* end; */
/* file a filevar=ytext; */

     ytext = 'ydp' || trim(yfile) || '.inc'; 

/* new code below */

put 'FILE ' ytext;


website='/epcd/nonemployer/2001/';
yinc = '<option value="' || trim(website) || trim(fname) ||'">';
put yinc;
put '2001</option>';
website='/epcd/nonemployer/2000/';
yinc = '<option value="' || trim(website) || trim(fname) ||'">';
put yinc;
put '2000</option>';

website='/epcd/nonemployer/1999/';
yinc = '<option value="' || trim(website) || trim(fname) ||'">';
put yinc;
put '1999</option>';
website='/epcd/nonemployer/1998/';

yinc = '<option value="' || trim(website) || trim(fname) ||'">';
put yinc;
put '1998</option>';
website='/epcd/nonemployer/1997/';
yinc = '<option value="' || trim(website) || trim(fname) ||'">';
put yinc;
put '1997</option>';
run;

/*create inc file that contains the HTML source for year pull down
in summary page*/

proc sort data=ypddata;
by allsect;
run;


data _null_;
length yinc $ 150 website $ 44 ystext $ 85;
retain ystext;                              /*ystext for summary page*/
set ypddata;
by allsect;

/* open new consolidated file to hold all ysp*.inc files */

file 'sys_temp:[ec97.htmlwork]nonempysp.inc';


ylength = length(trim(allsect));       /*length of allsect = M0040.HTM*/
yfile = substr(allsect,1,ylength-4);   /*take out .HTM     = M0040 */

/*************************************************************************/
/** Rao Katikinenei : Modification on July 29, 2003 disbaling code below */
/** and write all ysp*.inc to a single file                              */
/** **********************************************************************/
/*example inc file locates in sys_temp:[ec97.htmlwork]yspM0040.inc
ysp stands for year in summary page*/

/* if first.allsect then */
/* do; */
/*   ystext = 'sys_temp:[ec97.htmlwork]ysp' || trim(yfile) || '.inc'; */
/*   file a filevar=ystext; */
/* end; */
if first.allsect then
do;
ystext = 'ysp' || trim(yfile) || '.inc';

put 'FILE ' ystext;
website='/epcd/nonemployer/2001/';
yinc = '<option value="' || trim(website) || trim(stfile) || '/' ||
trim(yfile) || '.HTM' || '">';
put yinc;
put '2001</option>';
website='/epcd/nonemployer/2000/';
yinc = '<option value="' || trim(website) || trim(stfile) || '/' ||
trim(yfile) || '.HTM' || '">';
put yinc;
put '2000</option>';
website='/epcd/nonemployer/1999/';
yinc = '<option value="' || trim(website) ||  trim(stfile) || '/' ||
trim(yfile) || '.HTM' ||  '">';
put yinc;
put '1999</option>';

website='/epcd/nonemployer/1998/';
yinc = '<option value="' || trim(website) ||  trim(stfile) || '/' ||
trim(yfile) || '.HTM' || '">';
put yinc;
put '1998</option>';

website='/epcd/nonemployer/1997/';
yinc = '<option value="' || trim(website) ||  trim(stfile) || '/' ||
trim(yfile) ||'.HTM' || '">';
put yinc;
put '1997</option>';
end;
run;