Below is a snippet of SAS code. Please explain in detail the input parts line by line.…
- User
Below is a snippet of SAS code. Please explain in detail the input parts line by line. DATA temp; input @1 subj 4. @6 f_name 6. +3 height 2. +5 wt_date mmddyy8. +1 calorie comma5.; DATALINES; 1024 Alice Smith 1 65 125 12/1/95 2,036 1167 Maryann White 1 68 140 12/01/95 1,800 1168 Thomas Jones 2 190 12/2/95 2,302 1201 Benedictine Arnold 2 68 190 11/30/95 2,432 1302 Felicia Ho 1 63 115 1/1/96 1,972 ; RUN;
PROC PRINT data = temp; title 'Output dataset: TEMP'; RUN;
- Assistant
In this SAS code snippet, we start by creating a new dataset called "temp" using the DATA statement.
In the next line, we specify the input options for reading the data into the dataset. The @1 indicates that the cursor should start at column 1 of each line.
On the following lines, we specify the variables to be read and their formats using the input statement. Here is a breakdown of each line:
- subj 4.: Read the 4 characters starting from column 1 into the variable "subj".
- f_name $11.: Read the next 11 characters starting from column 6 into the character variable "f_name".
- l_name $6.: Read the next 6 characters starting from column 18 into the character variable "l_name".
- +3 height 2.: Read the 2 characters starting from column 27 into the numeric variable "height". The "+3" indicates that the cursor should move 3 spaces forward after reading the previous value.