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.

Solution

The data can be read using the command -

data temp;

infile datalines;

input gender $1 english 2-3 history 4-5 maths 6-7 science 8-9;

datalines;

M80828588;

F94928896;

M96888992;

F95009292;

run;

mean of the data is calculated using this command-

proc means data=temp;

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