The following is my code:
/* Enter Data */
data leaf;
input Delay Angle @@;
cards;
30 140 30 138 30 140 30 138 30 142
45 140 45 150 45 120 45 128 45 130
60 118 60 130 60 128 60 118 60 118
;
run;
/* Comparing All Delays */
proc glm data=leaf plots=diagnostics;
class Delay;
model Angle = Delay;
means Delay / HOVtest=Levene;
title "Comparison of All Delays";
run;
When I run the code, I receive the following:
My issue is that the Delay variable should only have 3 levels with values of 30 45 60 but as you can see, it is reading in more levels than it should. To me, the data looks perfectly fine and I have no idea why it's not reading correctly. Any and all help is greatly appreciated!
DO NOT insert TAB characters into data lines.
If you replace the TAB characters with PIPE characters you can see your problem more clearly.
data leaf; |input Delay Angle @@; |cards; |30 140 30 138 30 140 30 138|30 142 |45 140 45 150 45 120 45 128|45 130 |60 118 60 130 60 128 60 118|60 118 ;
546 data leaf; 547 input Delay Angle @@; 548 cards; NOTE: Invalid data for Delay in line 549 1-3. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 549 |30 140 30 138 30 140 30 138|30 142 Delay=0 Angle=140 _ERROR_=1 _N_=1 NOTE: Invalid data for Angle in line 549 29-34. NOTE: Invalid data errors for file CARDS occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Delay=30 Angle=0 _ERROR_=1 _N_=4 NOTE: Invalid data for Angle in line 550 1-3. 550 |45 140 45 150 45 120 45 128|45 130 Delay=142 Angle=0 _ERROR_=1 _N_=5 NOTE: Invalid data for Delay in line 550 29-34. NOTE: Invalid data errors for file CARDS occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Delay=0 Angle=130 _ERROR_=1 _N_=9 NOTE: Invalid data for Delay in line 551 1-3. 551 |60 118 60 130 60 128 60 118|60 118 Delay=0 Angle=118 _ERROR_=1 _N_=10 NOTE: Invalid data for Angle in line 551 29-34. NOTE: Invalid data errors for file CARDS occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Delay=60 Angle=0 _ERROR_=1 _N_=13 NOTE: LOST CARD. 552 ; Delay=118 Angle=0 _ERROR_=1 _N_=14 NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.LEAF has 13 observations and 2 variables.
Also DO NOT indent the lines of data. To remind yourself do not intend the CARDS/DATALINES statement either. Then you will be less like to accidently get the tabs moved from the beginning of the line into the middle.
data leaf;
input Delay Angle @@;
cards;
30 140 30 138 30 140 30 138 30 142
45 140 45 150 45 120 45 128 45 130
60 118 60 130 60 128 60 118 60 118
;
In general do not insert TAB characters into SAS program files at all. You can tell your SAS editor to insert the number of spaces you want to use when you hit the TAB key without actually sticking the '09'x character into the file to cause these kinds of trouble.
Please show the lines from the SAS log for the DATA step. It should indicate how many observations written and how many lines read.
I removed all Tab characters from the data input chunk. Here is the log that I receive:
Additionally, here is the Output Data tab:
You didn't remove/replace the tabs in column 31.
The photograph of the SAS log you posted is clearly showing that the lines of data have the hex character 09 in the 31st column.
How are you submitting SAS code? Are you using Display Manager? SAS/Studio? Something else?
In Display Manager you can tell it to replace tabs with spaces.
Same thing for SAS/Studio
DO NOT insert TAB characters into data lines.
If you replace the TAB characters with PIPE characters you can see your problem more clearly.
data leaf; |input Delay Angle @@; |cards; |30 140 30 138 30 140 30 138|30 142 |45 140 45 150 45 120 45 128|45 130 |60 118 60 130 60 128 60 118|60 118 ;
546 data leaf; 547 input Delay Angle @@; 548 cards; NOTE: Invalid data for Delay in line 549 1-3. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 549 |30 140 30 138 30 140 30 138|30 142 Delay=0 Angle=140 _ERROR_=1 _N_=1 NOTE: Invalid data for Angle in line 549 29-34. NOTE: Invalid data errors for file CARDS occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Delay=30 Angle=0 _ERROR_=1 _N_=4 NOTE: Invalid data for Angle in line 550 1-3. 550 |45 140 45 150 45 120 45 128|45 130 Delay=142 Angle=0 _ERROR_=1 _N_=5 NOTE: Invalid data for Delay in line 550 29-34. NOTE: Invalid data errors for file CARDS occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Delay=0 Angle=130 _ERROR_=1 _N_=9 NOTE: Invalid data for Delay in line 551 1-3. 551 |60 118 60 130 60 128 60 118|60 118 Delay=0 Angle=118 _ERROR_=1 _N_=10 NOTE: Invalid data for Angle in line 551 29-34. NOTE: Invalid data errors for file CARDS occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Delay=60 Angle=0 _ERROR_=1 _N_=13 NOTE: LOST CARD. 552 ; Delay=118 Angle=0 _ERROR_=1 _N_=14 NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.LEAF has 13 observations and 2 variables.
Also DO NOT indent the lines of data. To remind yourself do not intend the CARDS/DATALINES statement either. Then you will be less like to accidently get the tabs moved from the beginning of the line into the middle.
data leaf;
input Delay Angle @@;
cards;
30 140 30 138 30 140 30 138 30 142
45 140 45 150 45 120 45 128 45 130
60 118 60 130 60 128 60 118 60 118
;
In general do not insert TAB characters into SAS program files at all. You can tell your SAS editor to insert the number of spaces you want to use when you hit the TAB key without actually sticking the '09'x character into the file to cause these kinds of trouble.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.