BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

Why do I get empty data set???

Please not that there is space between 655 and - and between - and  60039652

Data tbl;
input ID $100.;
cards;
655 - 60039652
;
Run;
3 REPLIES 3
Ksharp
Super User

The default max length of string in CARDS is 80 . try 80.

 

Data tbl;
input ID $80.;
cards;
655 - 60039652
;
Run;
novinosrin
Tourmaline | Level 20

Hi @Ronein  You may have noticed a note "NOTE: SAS went to a new line when INPUT statement reached past the end of a line."
in the LOG. This is a default behavior of SAS when reading variable length records as to when SAS continues to read for the number of bytes provided by the width in the informat, which in your case is 100.

So what happens here is, SAS tends to do that and clears the input buffer leaving no values to read while attempting to read the next dataline. To override this default behavior, you need a TRUNCOVER  in INFILE statement.

 

Example:

infile cards truncover;

Data tbl;
infile cards truncover;
input ID $100.;
cards;
655 - 60039652
;
Run 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 856 views
  • 1 like
  • 4 in conversation