Hello everybody,
I've tried creating the following dataset using Sas University Edition
data type1;
input measure lab day;
cards;
99.57 1 1
98.33 1 1
100.13 1 1
100.29 1 1
98.85 1 2
101.19 1 2
101.19 1 2
99.96 1 2
100.33 1 3
100.17 1 3
99.81 1 3
100.72 1 3
99.91 2 1
102.68 2 1
100.36 2 1
100.61 2 1
101.57 2 2
100.56 2 2
100.40 2 2
99.67 2 2
100.79 2 3
99.16 2 3
101.21 2 3
102.12 2 3
;
However, when I run it I receive this log output :
1. Try again making sure ... a single space between the values
Almost certainly this is the problem, there are characters that look like spaces but are not spaces and are invalid characters when you read them into SAS as numerics. This sometimes happens because pasting data from some documents into SAS introduces these problems, PowerPoint is a good example of a program that can do this.
It read fine for me, but it looks like the errors are in the first line.
I don't see anything that could cause the issue either. Are you using a Windows or Mac?
I would:
1. Try again making sure my data was aligned correctly with a single space between the values
2. Try reading it from a file rather than in the browser
3. Try pasting the data lines into a text editor, such as NotePad++ or TextWrangler and remove any white space characters that are invisible. You can do this via the point and click editors in the menu, unfortunately I don't recall the exact one.
This is the code I used, note that I placed it in a code block to try and prevent any extraneous characters from entering - browsers sometimes add their own components. Speaking of, do you have any browser add ons?
data type1;
input measure lab day;
cards;
99.57 1 1
98.33 1 1
100.13 1 1
100.29 1 1
98.85 1 2
101.19 1 2
101.19 1 2
99.96 1 2
100.33 1 3
100.17 1 3
99.81 1 3
100.72 1 3
99.91 2 1
102.68 2 1
100.36 2 1
100.61 2 1
101.57 2 2
100.56 2 2
100.40 2 2
99.67 2 2
100.79 2 3
99.16 2 3
101.21 2 3
102.12 2 3
;
@NicoPol wrote:
Hello everybody,
I've tried creating the following dataset using Sas University Edition
data type1;
input measure lab day;
cards;
99.57 1 1
98.33 1 1
100.13 1 1
100.29 1 1
98.85 1 2
101.19 1 2
101.19 1 2
99.96 1 2
100.33 1 3
100.17 1 3
99.81 1 3
100.72 1 3
99.91 2 1
102.68 2 1
100.36 2 1
100.61 2 1
101.57 2 2
100.56 2 2
100.40 2 2
99.67 2 2
100.79 2 3
99.16 2 3
101.21 2 3
102.12 2 3
;
However, when I run it I receive this log output :
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;6162 data type1;63 input measure lab day;65 cards;NOTE: Invalid data for measure in line 66 1-9.NOTE: Invalid data for lab in line 67 1-9.NOTE: Invalid data for day in line 68 1-10.RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----068 CHAR 100.13.1.1ZONE 33323303032222222222222222222222222222222222222222222222222222222222222222222222NUMR 100E1391910000000000000000000000000000000000000000000000000000000000000000000000NOTE: Invalid data errors for file CARDS occurred outside the printed range.NOTE: Increase available buffer lines with the INFILE n= option.measure=. lab=. day=. _ERROR_=1 _N_=1NOTE: Invalid data for measure in line 69 1-10.NOTE: Invalid data for lab in line 70 1-9.NOTE: Invalid data for day in line 71 1-10.71 CHAR 101.19.1.2ZONE 33323303032222222222222222222222222222222222222222222222222222222222222222222222NUMR 101E1991920000000000000000000000000000000000000000000000000000000000000000000000NOTE: Invalid data errors for file CARDS occurred outside the printed range.NOTE: Increase available buffer lines with the INFILE n= option.measure=. lab=. day=. _ERROR_=1 _N_=2NOTE: Invalid data for measure in line 72 1-10.NOTE: Invalid data for lab in line 73 1-9.NOTE: Invalid data for day in line 74 1-10.74 CHAR 100.33.1.3ZONE 33323303032222222222222222222222222222222222222222222222222222222222222222222222NUMR 100E3391930000000000000000000000000000000000000000000000000000000000000000000000NOTE: Invalid data errors for file CARDS occurred outside the printed range.NOTE: Increase available buffer lines with the INFILE n= option.measure=. lab=. day=. _ERROR_=1 _N_=3NOTE: Invalid data for measure in line 75 1-10.NOTE: Invalid data for lab in line 76 1-9.NOTE: Invalid data for day in line 77 1-10.77 CHAR 100.72.1.3ZONE 33323303032222222222222222222222222222222222222222222222222222222222222222222222NUMR 100E7291930000000000000000000000000000000000000000000000000000000000000000000000NOTE: Invalid data errors for file CARDS occurred outside the printed range.NOTE: Increase available buffer lines with the INFILE n= option.measure=. lab=. day=. _ERROR_=1 _N_=4NOTE: Invalid data for measure in line 78 1-9.NOTE: Invalid data for lab in line 79 1-10.NOTE: Invalid data for day in line 80 1-10.80 CHAR 100.36.2.1ZONE 33323303032222222222222222222222222222222222222222222222222222222222222222222222NUMR 100E3692910000000000000000000000000000000000000000000000000000000000000000000000NOTE: Invalid data errors for file CARDS occurred outside the printed range.NOTE: Increase available buffer lines with the INFILE n= option.measure=. lab=. day=. _ERROR_=1 _N_=5NOTE: Invalid data for measure in line 81 1-10.NOTE: Invalid data for lab in line 82 1-10.NOTE: Invalid data for day in line 83 1-10.RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----083 CHAR 100.56.2.2ZONE 33323303032222222222222222222222222222222222222222222222222222222222222222222222NUMR 100E5692920000000000000000000000000000000000000000000000000000000000000000000000NOTE: Invalid data errors for file CARDS occurred outside the printed range.NOTE: Increase available buffer lines with the INFILE n= option.measure=. lab=. day=. _ERROR_=1 _N_=6NOTE: Invalid data for measure in line 84 1-10.NOTE: Invalid data for lab in line 85 1-9.NOTE: Invalid data for day in line 86 1-10.86 CHAR 100.79.2.3ZONE 33323303032222222222222222222222222222222222222222222222222222222222222222222222NUMR 100E7992930000000000000000000000000000000000000000000000000000000000000000000000NOTE: Invalid data errors for file CARDS occurred outside the printed range.NOTE: Increase available buffer lines with the INFILE n= option.measure=. lab=. day=. _ERROR_=1 _N_=7NOTE: Invalid data for measure in line 87 1-9.NOTE: Invalid data for lab in line 88 1-10.NOTE: Invalid data for day in line 89 1-10.89 CHAR 102.12.2.3ZONE 33323303032222222222222222222222222222222222222222222222222222222222222222222222NUMR 102E1292930000000000000000000000000000000000000000000000000000000000000000000000NOTE: Invalid data errors for file CARDS occurred outside the printed range.NOTE: Increase available buffer lines with the INFILE n= option.measure=. lab=. day=. _ERROR_=1 _N_=8NOTE: SAS went to a new line when INPUT statement reached past the end of a line.NOTE: The data set WORK.TYPE1 has 8 observations and 3 variables.NOTE: DATA statement used (Total process time):real time 0.00 secondscpu time 0.00 seconds90 ;9192 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;105How should I fix my code so that it is read?Thank you so much
1. Try again making sure ... a single space between the values
Almost certainly this is the problem, there are characters that look like spaces but are not spaces and are invalid characters when you read them into SAS as numerics. This sometimes happens because pasting data from some documents into SAS introduces these problems, PowerPoint is a good example of a program that can do this.
data type1;
infile cards expandtabs truncover;
input measure lab day;
cards;
Thank you very much!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.