07-19-2016 01:19 PM - edited 07-19-2016 01:41 PM
In chapter 2.10 of Little SAS Book. There is an example data file named canoes as follows:
Bellatorum School: CSULA Time: 1:40.5
The Kraken School: ASU Time: 1:45.35
Black Widow School: UoA Time: 1:33.7
Koicrete School: CSUF Time: 1:40.25
Khaos School: UNLV Time: 2:03.45
Max School: UCSD Time: 1:26.47
Hakuna Matata School: UCLA Time: 1:20.64
Prospector School: CPSLO Time: 1:12.08
Andromeda School: CPP Time: 1:25.1
Kekoapohaku School: UHM Time: 1:24.49
The book shows how to read "School" and "Time" use colon modifier, but does not show how to read the entire data file, which should include the first variable: Canoe team's names. I tried it but with no success. I'm having trobule reading the "Hakuna Matata" part. It has a space in between and the delimiter of the data file is space. Can anyone show me how to read the above data file into SAS? Thanks!
07-19-2016 01:37 PM
I don't know what edition you are using, but the fifth edition includes the following code, which appears to read the RaceTime variable:
DATA canoeresults; INFILE 'c:\MyRawData\Canoes.dat'; INPUT @'School:' School $ @'Time:' RaceTime :STIMER8.; RUN;
The RaceTime variable will be read in terms of seconds. For example, the first observation has a RaceTime of 100.5 seconds.
07-19-2016 04:05 PM
Add before the input:
Informat teamname $20. ;
input teamname & <the other variables>
This assumes that the important but not mentioned two spaces after the team names is consitent.