4/20/2008

reading data that requires spedcial intructions(Formatted input)

SAS can read numeric data that is in special formats such as binary, packed decimals, date/time.

example: formatted input
data std;
input name$ 1-15 age 17-18 class 20 sex 22 grade comma5.2;
datalines;
ali sahin 21 4 0 3,11
hüseyin karatas 20 2 1 2,90
;
run;
proc print;
run;

note that in thi example numbers for grade variable has character ',' ( with blank ti has 5 place and the value with 2 decimals so comma5.2
if we have 31,12 we have to write comma6.2

example: formatted input

data std;
input name$ 1-15 age 17-18 class 20 sex 22 grade 24-27 birthdate ddmmyy11.;
datalines;
ali sahin 21 4 0 3.11 21/02/1986
hüseyin karatas 20 2 1 2.90 13/06/1987
;
run;
proc print;
run;

No comments: