BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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 

 

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
  • 3 replies
  • 470 views
  • 1 like
  • 4 in conversation