Data file scorestxt contains character variable gender M or

Data file scores.txt contains character variable gender: (M or F) and four test scores (English, History, Math and science) which are numeric. Read The data in SAS. Calculate average of four test scores and print first five observations by using PROC PRINT statement. M 80 82 85 88 F 94 92 88 96 M 96 88 89 92 F 95 . 92 92

Solution

data raw;

infile \'scores.txt\';

input gender $1. Eng Hist Math Sci;

run;

data avg;

set raw;

avg=mean(Eng.Hist,Math,Sci);

run;

proc print data=avg obs=5;

run;

 Data file scores.txt contains character variable gender: (M or F) and four test scores (English, History, Math and science) which are numeric. Read The data in

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site