OPTIONS LS=75 NODATE; /* This code uses DO loops */ DATA drug (keep=y antibiotic); INPUT antibiotic $15. @; DO rep=1 TO 4;/* do loop */ INPUT y @; /* @ keeps SAS from reading in new data vector, thus */ OUTPUT; /* writing variables to dataset at each iteration of loop */ END; CARDS; Penicillin G 29.6 24.3 28.5 32 Tetracyclin 27.3 32.6 30.8 34.8 Streptomycin 5.8 6.2 11 8.3 Erythromycin 21.6 17.4 18.3 19 Chloramphenicol 29.2 32.8 25 24.2 ; RUN; DATA drug (keep=y antibiotic); LENGTH antibiotic $15; * this LENGTH statement ensures the G in Penicillin G gets kept; ARRAY reps{4} rep1-rep4; INPUT rep1-rep4 antibiotic $ 29-43; DO i=1 to 4; y=reps{i}; OUTPUT; END; CARDS; 29.6 24.3 28.5 32 Penicillin G 27.3 32.6 30.8 34.8 Tetracyclin 5.8 6.2 11 8.3 Streptomycin 21.6 17.4 18.3 19 Erythromycin 29.2 32.8 25 24.2 Chloramphenicol ; run; PROC GLM; CLASS antibiotic; MODEL y=antibiotic/SOLUTION; MEANS antibiotic; /* reports means and standard deviations by antibiotic */ /* options compute betahat which agrees w/ lecture notes in particular, the generalized inverse which is chosen by SAS is the one which corresponds to the default parameterization which takes the mean of chloramphenicol (last in dataset) as the baseline so that E(chloramphenicol) = beta0 */ RUN;