/* 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 "UChatham Persistence Report, &yr1" / @1 "" / @1 '' / @1 "

" "University of Chatham Freshman Persistence Rates, &yr1

" / @1 '' / @1 '
'; * Close out everything that is still open and put a footnote when *; * you reach the last observation. *; if last then put @1 '
"; * Write out the campus link and start a new list for each campus. *; if first.instno then put @1 '
  • ' instid $instb. '
      '; * Write out the division link and start a new list for each division. *; if first.schlno then put @1 '
    • ' schlname '
        '; * Write out a link for each department. *; put @1 '
      • ' deptname ''; * End the unnumbered list for each division and campus when *; * appropriate. *; if last.schlno then put @1 '
      '; if last.instno then put @1 '
    '; * End the column with the fourth and seventh campuses. *; if last.instno and instno in(4,7) then put @1 '
  • ' / @1 "

    " "University of Chatham Planning/Persist.GR001/&sysdate

    " / ; run; %mend; run; ****************************************************************************** ****************************************************************************; * Section 4. PROC TABULATE macro that runs Web and printed output. WEB1 *; * & WEB2 macros call this macro, and PRT1 executes it for hardcopy output. *; ****************************************************************************; %macro listing; title1 "Graduation, Retention, and Persistence Rates for #byval(type1) in " "#byval(instid)"; title2 "Specified Number of Semesters After First Enrollment"; * WHERE subsets the data for each department, division, or campus. *; * SEPVAR is blank when for WEB2, and set to NOSEPS for WEB1 and PRT1. *; proc tabulate data=one(where=(&where)) order=formatted missing &sepvar; by type1 instid; class acadyr yr sem type3 type2 instid school major1; * FMT takes on different values for dept, division, and campus. *; format type2 &fmt; * SPAN is set at the beginning of the program. *; var count sem01-sem&span sch01-sch&span dpt01-dpt&span; * VAR1 takes on different values for dept, division, and campus. *; * VAR2 refers to the different variable sets for each level. *; * VAR2 is DPT for departments, SCH for divisions, and SEM for campuses. *; table &var1 (type3=' ')* (acadyr=' '), (type2=' ')* (count=' '*sum='N'*f=comma6. &var2.01=' '*pctsum='1'*f=5.1 &var2.02=' '*pctsum='2'*f=5.1 &var2.03=' '*pctsum='3'*f=5.1 &var2.04=' '*pctsum='4'*f=5.1 &var2.05=' '*pctsum='5'*f=5.1 &var2.06=' '*pctsum='6'*f=5.1 &var2.07=' '*pctsum='7'*f=5.1 &var2.08=' '*pctsum='8'*f=5.1 &var2.09=' '*pctsum='9'*f=5.1 &var2.10=' '*pctsum='10'*f=5.1) /rts=&rts. &indent; * RTS and INDENT vary based on the type of output desired. *; footnote1 "________________________________________________________ &blanks "; footnote2 "University of Chatham Planning/Persist.GR001/&SYSDATE &blanks "; run; %mend; run; ****************************************************************************** ****************************************************************************; * Section 5. PRT1 produces hardcopy output. *; ****************************************************************************; %macro prt1; * Default macro values for PROC TABULATE in "%listing" *; %let sepvar=noseps; %let rts=20; %let indent=indent=3; run; %listing; * Produce the actual PROC TABULATE output. *; run; %mend; run; ****************************************************************************** **************************************************************************; * Section 6. WEB1 uses PROC PRINTTO and PUT to redirect hardcopy as *; * preformatted text. *; **************************************************************************; %macro web1; * 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;data _null_; file prt; * Write HTML tags at the beginning of the file. *; put @1 ""/ @1 "" / @1 " UChatham Persistence Report, &yr1 " / @1 "" / @1 '' / @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;