/*-----------------------------------------------------------------
            S A S   S A M P L E   L I B R A R Y                   
                                                                  
      NAME: ODSEX9                                                
     TITLE: Documentation Example 9 for ODS                       
   PRODUCT: STAT                                                  
    SYSTEM: ALL                                                   
      KEYS: ODS                                                   
     PROCS: GLM, SGPLOT                                           
      DATA:                                                       
                                                                  
   SUPPORT: saswfk                UPDATE: July 25, 2011           
       REF: Using the Output Delivery System                      
      MISC:                                                       
-----------------------------------------------------------------*/

title 'Treatment of Leprosy';

data drugtest;
   input Drug $ PreTreatment PostTreatment @@;
   datalines;
a 11  6  a  8  0  a  5  2  a 14  8  a 19 11
a  6  4  a 10 13  a  6  1  a 11  8  a  3  0
d  6  0  d  6  2  d  7  3  d  8  1  d 18 18
d  8  4  d 19 14  d  8  9  d  5  1  d 15  9
f 16 13  f 13 10  f 11 18  f  9  5  f 21 23
f 16 12  f 12  5  f 12 16  f  7  1  f 12 20
;

/*
ods _all_ close;
ods html body='glmb.htm' contents='glmc.htm' frame='glmf.htm' style=HTMLBlue;
*/

proc glm data=drugtest;
   class drug;
   model PostTreatment = drug | PreTreatment / solution;
   lsmeans drug / stderr pdiff;
   ods output LSMeans=lsmeans;
quit;

data lsmeans;
   set lsmeans;
   if drug='a' then DrugClick='drug1.htm';
   if drug='d' then DrugClick='drug2.htm';
   if drug='f' then DrugClick='drug3.htm';
run;

*
ods graphics / imagemap=yes height=2in width=6.4in;

proc sgplot data=lsmeans;
   title 'Chart of LS-Means for Drug Type';
   hbar drug / response=lsmean stat=mean
               url=drugclick;
   footnote j=l 'Click on the bar to see a plot of PostTreatment '
                'versus PreTreatment for the corresponding drug.';
   format lsmean 6.3;
run;

*
ods graphics off;
footnote;
*
ods html close;

*
ods html body='drug1.htm' newfile=page style=HTMLBlue;

proc sgplot data=drugtest;
   title 'Plot of PostTreatment versus PreTreatment';
   scatter y=PostTreatment x=PreTreatment;
   by drug notsorted;
run;
*
ods html close;