/* Data Step */ data drugtest; input Drug $ PreTreatment PostTreatment @@; /* input the variable name */ /* with @@ in the 'input' line, SAS will read data until the end of the line*/ 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 run; /* Observation list*/ title "Drugtest Data"; /*the title of the output*/ proc print data = drugtest; /* list all the observations*/ run; /* Frequency Table for Drugtest */ TITLE "Drugtest Frequency Table"; PROC FREQ DATA = drugtest; TABLES Drug; /* show the frequency table of the variable 'Drug'*/ RUN; /*Histogram of the Compresssive Strength*/ TITLE 'Data in Table 1.2-1'; DATA block; INPUT strength @@; DATALINES ; 49.2 53.9 50.0 44.5 42.2 42.3 32.3 31.3 60.9 47.5 43.5 37.9 41.1 57.6 40.2 45.3 51.7 52.3 45.7 53.4 51.0 45.7 45.9 50.0 32.5 67.2 55.1 59.6 48.6 50.3 45.1 46.8 47.4 38.3 41.5 44.0 62.2 62.9 56.3 35.8 38.3 33.5 48.5 47.4 49.6 41.3 55.2 52.1 34.3 31.6 38.2 46.0 47.0 41.2 39.8 48.4 49.2 32.8 47.9 43.3 49.3 54.5 54.1 44.5 46.2 44.4 45.1 41.5 43.4 39.1 39.1 41.6 43.1 43.7 48.8 37.2 33.6 28.7 33.8 37.4 43.5 44.2 53.0 45.1 51.9 50.6 48.5 39.0 47.3 48.8 ; RUN; /* Group the data*/ PROC FORMAT; VALUE sformat low-<32 ='28-32' 32-<36='32-36' 36-<40='36-40' 40-<44='40-44' 44-<48='44-48' 48-<52='48-52' 52-<56='52-56' 56-<60='56-60' 60-<64='60-64' 64-<68='64-68'; RUN; /*Frequency Table of the grouped data*/ PROC FREQ DATA=block; TABLES strength; FORMAT strength sformat.; RUN; /*Histogram*/ PROC UNIVARIATE DATA =block plots ; /*show the plot of the data*/ VAR strength; HISTOGRAM / MIDPOINTS=30 TO 66 BY 4 /*Specify the midpoints*/ VSCALE=count; /*The y-axis is the frequency (count number) */ RUN;