dm 'log;clear;output;clear';
ods html close; ods html style=minimal body='Assignment 09 Example.html';
ods graphics on;
options nodate nocenter pageno=1 ls=90 ps=56;
ODS listing;
************************************************;
*** James P Geaghan ***;
*** EXST 700x two-sample t-test Examples ***;
*** Assignment 09 ***;
**********************************************************************;
*** Examples are from your text book ***;
*** Freund, Rudolph J., William J. Wilson and Donna L. Mohr. 2010. ***;
*** Statistical Methods, Academic Press (ELSIVIER), N.Y ***;
**********************************************************************;
title1 "Assignment 09 - Pollution example";
data Multi (keep=AreaA AreaB diff)
Pollution (keep=Area index);
INFILE 'datatab_5_13b.csv' dlm=',' dsd missover firstobs=2;
input AreaA AreaB;
diff = AreaA - AreaB; output multi;
Area = 'A'; Index = AreaA; Output Pollution;
Area = 'B'; Index = AreaB; Output Pollution;
datalines; run;
;
run;
*proc print data=Multi; run;
*proc print data=Pollution; run;
PROC ttest data=multi sides=u;
title2 'Pollution example done as a paired t-test with Proc TTEST';
TITLE3 'One-tailed hypothesis';
VAR diff;
RUN;
PROC ttest data=Pollution sides=u;
title2 'Pollution example done as a tw0-sample t-test with Proc TTEST';
TITLE3 'One-tailed hypothesis';
CLASS area;
VAR Index;
RUN;
title1 "Assignment 09 - Light bulb life expectany example";
data bulbs;
INFILE 'datatab_5_17.txt' missover firstobs=2;
input brand $ life;
datalines; run;
;
run;
PROC ttest data=bulbs;
CLASS brand;
VAR life;
title2 "The two-sample t-test";
TITLE3 'Two-tailed hypothesis';
RUN;
proc sort data=bulbs; by brand;
PROC UNIVARIATE data=bulbs normal plots CIBASIC; by brand;
VAR life;
ods exclude BasicMeasures ExtremeObs ExtremeValues Modes
MissingValues Quantiles TestsForLocation;
RUN;
PROC BOXPLOT data=bulbs; plot life*brand; run;
/*
data bulbs2; set bulbs;
if life gt 2500 then delete;
run;
PROC ttest data=bulbs2;
CLASS brand;
VAR life;
title2 "The two-sample t-test";
TITLE3 'Two-tailed hypothesis';
RUN;
proc sort data=bulbs2; by brand;
PROC UNIVARIATE data=bulbs2 normal plots CIBASIC; by brand;
VAR life;
ods exclude BasicMeasures ExtremeObs ExtremeValues Modes
MissingValues Quantiles TestsForLocation;
RUN;
PROC BOXPLOT data=bulbs2; plot life*brand; run;
*/