BookmarkSubscribeRSS Feed
westbestern
Obsidian | Level 7

I'm inputting RECID data into SAS and I keep getting errors about invalid data. What's wrong with my input??

 

Here is the my first 20 datalines:

data recid;
   input id$ week arrest$ fin$ age race$ wexp$ mar$ paro$ prio educ$;
   cards;
1       20      1       0       27      1       0       0       1	3	3
2       17	1	0	18	1	0	0	1	8	4
3	25	1	0	19	0	1	0	1	13	3
4	53	0	1	23	1	1	1	1	1	5
5	53	0	0	19	0	1	0	1	3	3
6	53	0	0	24	1	1	0	0	2	4
7	23	1	0	25	1	1	1	1	0	4
8	53	0	1	21	1	1	0	1	4	3
9	53	0	0	22	1	0	0	0	6	3
10	53	0	0	20	1	1	0	0	0	5
11	53	0	1	26	1	0	0	1	3	3
12	53	0	0	40	1	1	0	0	2	5
13	37	1	0	17	1	1	0	1	5	3
14	53	0	0	37	1	1	0	0	2	3
15	25	1	0	20	1	0	0	1	3	4
16	46	1	1	22	1	1	0	1	2	3
17	28	1	0	19	1	0	0	0	7	3
18	53	0	0	20	1	0	0	0	2	3
19	53	0	0	25	1	0	0	1	12	3
20	53	0	0	24	0	1	0	1	1	3
;
run;

Below are the errors I'm getting:

 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         data recid;
 70            input id$ week arrest$ fin$ age race$ wexp$ mar$ paro$ prio educ$;
 71            cards;
 
 NOTE: Invalid data for week in line 75 1-23.
 NOTE: Invalid data for age in line 78 1-23.
 NOTE: Invalid data for prio in line 83 1-24.
 RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                     
 
 84  CHAR   13.37.1.0.17.1.1.0.1.5.3                                                        
     ZONE   33033030303303030303030322222222222222222222222222222222222222222222222222222222
     NUMR   13937919091791919091959300000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=32510 week=. arrest=55300 fin=65300 age=. race=85301 wexp=95300 mar=10530 paro=11530 prio=. educ=13371
 _ERROR_=1 _N_=2
 NOTE: Invalid data for week in line 86 1-24.
 NOTE: Invalid data for age in line 89 1-24.
 NOTE: Invalid data for prio in line 94 1-24.
 
 95  CHAR   24.53.0.1.28.0.1.0.1.1.3                                                        
     ZONE   33033030303303030303030322222222222222222222222222222222222222222222222222222222
     NUMR   24953909192890919091919300000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=14530 week=. arrest=16461 fin=17281 age=. race=19530 wexp=20530 mar=21530 paro=22530 prio=. educ=24530
 _ERROR_=1 _N_=3
 NOTE: Invalid data for week in line 97 1-24.
 NOTE: Invalid data for age in line 100 1-24.
 NOTE: Invalid data for prio in line 105 1-24.
 
 106 CHAR   35.53.0.0.24.1.1.0.0.3.4                                                        
     ZONE   33033030303303030303030322222222222222222222222222222222222222222222222222222222
     NUMR   35953909092491919090939400000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=25530 week=. arrest=27530 fin=28530 age=. race=30530 wexp=31530 mar=32530 paro=33530 prio=. educ=35530
 _ERROR_=1 _N_=4
 NOTE: Invalid data for week in line 108 1-24.
 NOTE: Invalid data for age in line 111 1-24.
 NOTE: Invalid data for prio in line 116 1-24.
 
 117 CHAR   46.53.0.1.22.1.0.0.0.2.4                                                        
     ZONE   33033030303303030303030322222222222222222222222222222222222222222222222222222222
     NUMR   46953909192291909090929400000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=36501 week=. arrest=38530 fin=39530 age=. race=41530 wexp=42530 mar=43101 paro=44530 prio=. educ=46530
 _ERROR_=1 _N_=5
 NOTE: Invalid data for week in line 119 1-24.
 NOTE: Invalid data for age in line 122 1-24.
 NOTE: Invalid data for prio in line 127 1-24.
 RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                     
 
 128 CHAR   57.53.0.0.33.1.1.1.1.1.4                                                        
     ZONE   33033030303303030303030322222222222222222222222222222222222222222222222222222222
     NUMR   57953909093391919191919400000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=47530 week=. arrest=49530 fin=50530 age=. race=52530 wexp=53530 mar=54501 paro=55530 prio=. educ=57530
 _ERROR_=1 _N_=6
 NOTE: Invalid data for week in line 130 1-24.
 NOTE: Invalid data for age in line 133 1-24.
 NOTE: Invalid data for prio in line 138 1-24.
 
 139 CHAR   68.53.0.1.22.1.1.0.1.2.3                                                        
     ZONE   33033030303303030303030322222222222222222222222222222222222222222222222222222222
     NUMR   68953909192291919091929300000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=58530 week=. arrest=60530 fin=61610 age=. race=63530 wexp=64530 mar=65521 paro=66530 prio=. educ=68530
 _ERROR_=1 _N_=7
 NOTE: Invalid data for week in line 141 1-24.
 NOTE: Invalid data for age in line 144 1-24.
 NOTE: Invalid data for prio in line 149 1-24.
 
 150 CHAR   79.53.0.0.21.0.0.0.0.2.3                                                        
     ZONE   33033030303303030303030322222222222222222222222222222222222222222222222222222222
     NUMR   79953909092190909090929300000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=69491 week=. arrest=71530 fin=72530 age=. race=74530 wexp=75530 mar=76530 paro=77431 prio=. educ=79530
 _ERROR_=1 _N_=8
 NOTE: Invalid data for week in line 152 1-24.
 NOTE: Invalid data for age in line 155 1-24.
 NOTE: Invalid data for prio in line 160 1-24.
 
 161 CHAR   90.53.0.1.24.1.0.0.1.2.4                                                        
     ZONE   33033030303303030303030322222222222222222222222222222222222222222222222222222222
     NUMR   90953909192491909091929400000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=80510 week=. arrest=82530 fin=83530 age=. race=85221 wexp=86530 mar=87530 paro=88181 prio=. educ=90530
 _ERROR_=1 _N_=9
 NOTE: Invalid data for week in line 163 1-24.
 NOTE: Invalid data for age in line 166 1-24.
 NOTE: Invalid data for prio in line 171 1-25.
 
 172 CHAR   101.2.1.0.44.1.1.0.1.2.5                                                        
     ZONE   33303030303303030303030322222222222222222222222222222222222222222222222222222222
     NUMR   10192919094491919091929500000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=91530 week=. arrest=93530 fin=94530 age=. race=96241 wexp=97530 mar=98530 paro=99530 prio=. educ=10121
 _ERROR_=1 _N_=10
 NOTE: Invalid data for week in line 174 1-25.
 NOTE: Invalid data for age in line 177 1-25.
 NOTE: Invalid data for prio in line 182 1-25.
 RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                     
 
 183 CHAR   112.53.0.1.23.1.1.0.1.3.4                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   11295390919239191909193940000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=102261 week=. arrest=104491 fin=105530 age=. race=107481 wexp=108530 mar=109530 paro=110530 prio=. educ=112530
 _ERROR_=1 _N_=11
 NOTE: Invalid data for week in line 185 1-25.
 NOTE: Invalid data for age in line 188 1-25.
 NOTE: Invalid data for prio in line 193 1-25.
 
 194 CHAR   123.53.0.1.24.0.1.1.1.2.3                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   12395390919249091919192930000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=113530 week=. arrest=115530 fin=116530 age=. race=118530 wexp=11981 mar=120530 paro=121530 prio=. educ=123530
 _ERROR_=1 _N_=12
 NOTE: Invalid data for week in line 196 1-25.
 NOTE: Invalid data for age in line 199 1-25.
 NOTE: Invalid data for prio in line 204 1-25.
 
 205 CHAR   134.13.1.0.23.1.0.0.0.5.3                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   13491391909239190909095930000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=124530 week=. arrest=126530 fin=127530 age=. race=129530 wexp=130530 mar=13181 paro=132530 prio=. educ=134131
 _ERROR_=1 _N_=13
 NOTE: Invalid data for week in line 207 1-25.
 NOTE: Invalid data for age in line 210 1-25.
 NOTE: Invalid data for prio in line 215 1-25.
 
 216 CHAR   145.53.0.1.24.1.1.0.1.1.5                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   14595390919249191909191950000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=135530 week=. arrest=137530 fin=138530 age=. race=140530 wexp=141331 mar=142530 paro=143530 prio=. educ=145530
 _ERROR_=1 _N_=14
 NOTE: Invalid data for week in line 218 1-25.
 NOTE: Invalid data for age in line 221 1-25.
 NOTE: Invalid data for prio in line 226 1-25.
 
 227 CHAR   156.52.1.0.25.0.1.0.1.1.3                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   15695291909259091909191930000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=146530 week=. arrest=148530 fin=149530 age=. race=151530 wexp=152530 mar=153530 paro=154441 prio=. educ=156521
 _ERROR_=1 _N_=15
 NOTE: Invalid data for week in line 229 1-25.
 NOTE: Invalid data for age in line 232 1-25.
 NOTE: Invalid data for prio in line 237 1-25.
 RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                     
 
 238 CHAR   167.53.0.0.18.0.0.0.1.6.3                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   16795390909189090909196930000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=157530 week=. arrest=159530 fin=160530 age=. race=162530 wexp=163530 mar=164530 paro=165530 prio=. educ=167530
 _ERROR_=1 _N_=16
 NOTE: Invalid data for week in line 240 1-25.
 NOTE: Invalid data for age in line 243 1-26.
 NOTE: Invalid data for prio in line 248 1-25.
 
 249 CHAR   178.53.0.1.22.1.0.0.1.6.6                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   17895390919229190909196960000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=168530 week=. arrest=170530 fin=171530 age=. race=17391 wexp=174171 mar=175530 paro=176530 prio=. educ=178530
 _ERROR_=1 _N_=17
 NOTE: Invalid data for week in line 251 1-26.
 NOTE: Invalid data for age in line 254 1-25.
 NOTE: Invalid data for prio in line 259 1-25.
 
 260 CHAR   189.53.0.1.24.1.0.0.0.13.4                                                      
     ZONE   33303303030330303030303303222222222222222222222222222222222222222222222222222222
     NUMR   18995390919249190909091394000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=179530 week=. arrest=181161 fin=182530 age=. race=18431 wexp=185530 mar=186530 paro=187530 prio=. educ=189530
 _ERROR_=1 _N_=18
 NOTE: Invalid data for week in line 262 1-25.
 NOTE: Invalid data for age in line 265 1-25.
 NOTE: Invalid data for prio in line 270 1-25.
 
 271 CHAR   200.53.0.0.20.0.0.0.0.2.3                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   20095390909209090909092930000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=190530 week=. arrest=192530 fin=193530 age=. race=195451 wexp=196530 mar=197530 paro=198530 prio=. educ=200530
 _ERROR_=1 _N_=19
 NOTE: Invalid data for week in line 273 1-25.
 NOTE: Invalid data for age in line 276 1-25.
 NOTE: Invalid data for prio in line 281 1-25.
 
 282 CHAR   211.53.0.1.20.1.1.0.1.1.4                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   21195390919209191909191940000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=201530 week=. arrest=203530 fin=204161 age=. race=206530 wexp=207530 mar=208530 paro=209530 prio=. educ=211530
 _ERROR_=1 _N_=20
 NOTE: Invalid data for week in line 284 1-25.
 NOTE: Invalid data for age in line 287 1-25.
 NOTE: Invalid data for prio in line 292 1-25.
 WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be printed.
 RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                     
 
 293 CHAR   222.53.0.1.20.1.1.0.1.1.3                                                       
     ZONE   33303303030330303030303032222222222222222222222222222222222222222222222222222222
     NUMR   22295390919209191909191930000000000000000000000000000000000000000000000000000000
 NOTE: Invalid data errors for file CARDS occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 id=212530 week=. arrest=214530 fin=215530 age=. race=217530 wexp=218530 mar=219530 paro=220530 prio=. educ=222530
 _ERROR_=1 _N_=21
 NOTE: LOST CARD.
 NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
 NOTE: The data set WORK.RECID has 40 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              689.37k
       OS Memory           24484.00k
       Timestamp           11/17/2021 07:57:35 PM
       Step Count                        96  Switch Count  2
       Page Faults                       0
       Page Reclaims                     162
       Page Swaps                        0
       Voluntary Context Switches        10
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           296
       
 
 504        ;
 505        run;
 506        
 507        *2;
 508        
 509        *3;
 510        
 511        *4;
 512        
 513        
 514        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 524        
4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

Your data seems to be tab-delimited.

You need to tell SAS. Look at the dlm= and maybe the dsd options for the infile statement.

SASKiwi
PROC Star

IMHO, using tabs when inputting data from lines in a program is an unnecessary complication. If you just removed them your program would work fine.

Kurt_Bremser
Super User

Not only are there tabs in the data, you have mixed blanks/tabs as delimiters, which complicates things.

Replace all white spaces with single blanks.

You should set your SAS editor to replace tabs with blanks on loading, saving and inputting. Code with tabs anywhere always develops into a PITA.

Kurt_Bremser
Super User

And IF you need tabs because you otherwise have trouble with delimiters in the data, or simply because you get a tab-separated file, then

  • make the tabs consistent
  • use the correct delimiter

:

data recid;
infile datalines dsd dlm="09"x;
input id$ week arrest$ fin$ age race$ wexp$ mar$ paro$ prio educ$;
datalines;
1	20	1	0	27	1	0	0	1	3	3
2	17	1	0	18	1	0	0	1	8	4
3	25	1	0	19	0	1	0	1	13	3
4	53	0	1	23	1	1	1	1	1	5
5	53	0	0	19	0	1	0	1	3	3
6	53	0	0	24	1	1	0	0	2	4
7	23	1	0	25	1	1	1	1	0	4
8	53	0	1	21	1	1	0	1	4	3
9	53	0	0	22	1	0	0	0	6	3
10	53	0	0	20	1	1	0	0	0	5
11	53	0	1	26	1	0	0	1	3	3
12	53	0	0	40	1	1	0	0	2	5
13	37	1	0	17	1	1	0	1	5	3
14	53	0	0	37	1	1	0	0	2	3
15	25	1	0	20	1	0	0	1	3	4
16	46	1	1	22	1	1	0	1	2	3
17	28	1	0	19	1	0	0	0	7	3
18	53	0	0	20	1	0	0	0	2	3
19	53	0	0	25	1	0	0	1	12	3
20	53	0	0	24	0	1	0	1	1	3
;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 355 views
  • 0 likes
  • 4 in conversation