/* Source Code for Obswww14 - Brown */ ****************************************************************************** ****************************************************************************** **************************************************************; * Section 1. Setting Parameters. Input values: Current year, *; * no. of semesters to be tracked, and runtype *; * (WEB1, WEB2, PRT1). *; **************************************************************; options sysparm="1998,10,WEB2" nodate nonumber ovp nobyline ls=165 ps=55 symbolgen nofmterr nosource2; libname in "/uchatham/planning"; libname library "/uchatham/fmts"; data _null_; length blanks $ 100; yr1=input(substr(sysparm(),1,4),4.); * Current year of report *; spn=input(substr(sysparm(),6,2),2.); * Number of semesters being tracked *; type=upcase(substr(sysparm(),9)); * Type of output desired *; blanks=repeat(' ',99); * Left justify footnotes *; call symput("yr1",compress(yr1)); call symput("span",compress(spn)); call symput("type",compress(type)); call symput("blanks",blanks); run; ****************************************************************************** **************************************************************; * Section 2. Building the index and counter data sets. *; **************************************************************; proc sort data=one; by instid schlname deptname; run; data one index(keep=instid instno schlno schlname deptno deptname) counter(keep=instno schlno deptno) ; *******************************************************************; * WORK.ONE contains the data to be displayed in PROC TABULATE. *; * WORK.INDEX has one observation per department and is used to *; * build the links from the index Web page to the *; * individual Web pages for each campus, division, and *; * department. *; * WORK.COUNTER has one observation per division and is used to *; * control the number of times the %LOOP1 macro *; * executes. *; *******************************************************************; ; set one; by instid schlname deptname; retain instno 0 schlno 0 deptno 0; * Increment campus counter, set division and dept counters to 0 *; * for each new instutition. *; if first.instid then do; instno=instno+1; schlno=0; deptno=0; end; * Increment division counter, set dept counter to 0 for each *; * college or school. *; if first.schlname then do; schlno=schlno+1; deptno=0; end; * Increment department counter for each new dept. *; if first.deptname then deptno=deptno+1; output one; if last.deptname then output index; if last.schlname then output counter; run; ****************************************************************************** ****************************************; * Section 3. Build an index Web page. *; ****************************************; %macro indxpage; * Identify where the Web page will be written. *; filename wwwout ftp "gw001.html" cd="public_html/air/" host="www.uchatham.edu" user="air98" pass="air98"; data _null_; set index end=last; by instno schlno deptno; file wwwout; if _n_=1 then do; * Write HTML tags at the beginning of the file. *; put @1 ""/ @1 "
" / @1 "";
* Write out the campus link and start a new list for each campus. *;
if first.instno then put
@1 '
| ';
* Close out everything that is still open and put a footnote when *;
* you reach the last observation. *;
if last then
put @1 '
";
* All subsequent text will be preformatted. *;run;
* Set values for TABULATE output. *;%let sepvar=noseps;
%let rts=20;%let indent=indent=3;run;
proc printto file=prt; * Route procedure output to Web page. *;run;
%listing; * Produce the actual PROC TABULATE output. *;run;
proc printto print=print; * Route procedure output back to default. *;run;%mend;
run;
******************************************************************************
****************************************************************************;
* Section 7. WEB2 uses SAS Web tools to build more extensive HTML code *;
* than WEB1. *;
****************************************************************************;
%macro web2;
* Identify where the Web page will be written. *;
filename prt ftp "gw1&i.&j.&k..html"
cd="public_html/air/campus"
host="www.uchatham.edu" user="air98" pass="air98";
run;
options nocenter ls=195 ps=85 formchar='82838485868788898a8b8c'x;
* Special FORMCHAR strings are required with TAB2HTM. *;
* See TAB2HTM documentation for operating system details. *;
* Set parameters for PROC TABULATE output. *;
%let sepvar=;
%let rts=40;
%let indent=;
run;
%tab2htm(capture=on,runmode=b); * Start capturing PROC TABULATE output. *;
run;
%listing; * Produces the actual PROC TABULATE output. *;
run;
%tab2htm(capture=off,
runmode=b,
rlcolor=blue,
clcolor=blue,
bgtype=image,
bg=../../marble1.jpg,
encode=N,
openmode=replace,
htmlfref=prt,
center=Y);
run;
* Turns off the output capture and passes parameters for *;
* TAB2HTM processing. See TAB2HTM documentation for details. *;
%mend;
run;
******************************************************************************
***********************************************;
* Section 8. LOOP1 runs all the other macros. *;
***********************************************;
%macro loop1;
* Build index Web page when appropriate. *;
%if "&type"="WEB1" %then %indxpage;
%if "&type"="WEB2" %then %indxpage;
%do i=1 %to 7; * Six campuses and UChatham total *;
data _null_;
set counter(where=(instno=&i));
call symput("maxschl",compress(schlno));
run;
%do j=1 %to &maxschl; * Number of divisions at given institution *;
data _null_;
set counter(where=(instno=&i and schlno=&j));
call symput("maxmaj",compress(deptno));
run;
%do k1=1 %to &maxmaj; * Number of departments within a division *;
data _null_;
call symput("k",compress(put(&k1,z2.)));
run;
* Macro variables for dept level Tabulate in "%listing" *;
%let where=instno=&i and schlno=&j and deptno=&k;
%let var1=(major1='Original Major: '),;
%let var2=dpt;
%let fmt=type2c.;
run;
%if "&type"="WEB1" %then %web1;
%else %if "&type"="WEB2" %then %web2;
%else %prt1;
* If the "%else" is removed, "%prt1" executes as well as the specified *;
* Web building macro. *;
%end; * End departmental listings ("k loop") *;
run;
* Macro variables for division level Tabulate in "%listing" *;
%let k=00;
%let where=instno=&i and schlno=&j;
%let var1=(school='Original Division: '),;
%let var2=sch;
%let fmt=type2b.;
run;
%if "&type"="WEB1" %then %web1;
%else %if "&type"="WEB2" %then %web2;
%else %prt1;
* If the "%else" is removed, "%prt1" executes as well as the specified *;
* Web building macro. *;
%end; * End divisional listings ("j loop") *;
run;
* Macro variables for campus level Tabulate in "%listing" *;
%let j=0;
%let where=instno=&i;
%let var1=;
%let var2=sem;
%let fmt=type2a.;
run;
%if "&type"="WEB1" %then %web1;
%else %if "&type"="WEB2" %then %web2;
%else %prt1;
* If the "%else" is removed, "%prt1" executes as well as the specified *;
* Web building macro. *;
%end; * End institutional listings ("i loop") *;
run;
%mend;
run;
%loop1; * Kick it off. *;
run;