Understanding DATA Step Processing |
Writing Basic DATA
Steps |
If you completed the prerequisites for this module, you learned how to
write a DATA step to create a permanent SAS data set from raw data in an
external file.
data clinic.stress; infile tests; input ID 1-4 Name $ 6-25 RestHR 27-29 MaxHR 31-33 RecHR 35-37 TimeMin 39-40 TimeSec 42-43 Tolerance $ 45; run; |
Raw Data File Tests
1---+----10---+----20---+----30---+----40---+- |
2458 Murray, W 72 185 128 12 38 D |
2462 Almers, C 68 171 133 10 5 I |
2501 Bonaventure, T 78 177 139 11 13 I |
2523 Johnson, R 69 162 114 9 42 S |
2539 LaMance, K 75 168 141 11 46 D |
2544 Jones, M 79 187 136 12 26 N |
2552 Reberson, P 69 158 139 15 41 D |
2555 King, E 70 167 122 13 13 I |
You learned how to submit the DATA step and check the log to see if the step ran successfully. |
SAS Log
NOTE: The infile TESTS is: FILENAME=may/t1/rawdata.dat Code=V Type=C _ERROR_=0 _N_=4 NOTE: 10 records were read from the infile TESTS. NOTE: The data set CLINIC.STRESS has 10 observations and 8 variables. NOTE: The DATA statement used 0:00:07.00 real 0:00:07.10 cpu. |
You also learned how to display the contents of the data set by using
the PRINT procedure.
proc print data=clinic.stress; run; |
Obs | ID | Name | RestHR | MaxHR | RecHR | TimeMin | TimeSec | Tolerance |
1 | 2458 | Murray, W | 72 | 185 | 128 | 12 | 38 | D |
2 | 2462 | Almers, C | 68 | 171 | 133 | 10 | 5 | I |
3 | 2501 | 78 | 177 | 139 | 11 | 13 | I | |
4 | 2523 | Johnson, R | 69 | 162 | 114 | 9 | 42 | S |
5 | 2539 | LaMance, K | 75 | 168 | 141 | 11 | 46 | D |
6 | 2544 | Jones, M | 79 | 187 | 136 | 12 | 26 | N |
7 | 2552 | Reberson, P | 69 | 158 | 139 | 15 | 41 | D |
8 | 2555 | King, E | 70 | 167 | 122 | 13 | 13 | I |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.