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; DATA drug; SET drug; PenicillinG = (antibiotic="Penicillin G") - (antibiotic="Chloramphenicol"); Tetracyclin = (antibiotic="Tetracyclin") - (antibiotic="Chloramphenicol"); Streptomycin = (antibiotic="Streptomycin") - (antibiotic="Chloramphenicol"); Erythromycin = (antibiotic="Erythromycin") - (antibiotic="Chloramphenicol"); RUN; PROC REG DATA=drug; MODEL y=PenicillinG Tetracyclin Streptomycin Erythromycin; RUN;