BookmarkSubscribeRSS Feed
hspears
Calcite | Level 5

Hi!

I want to read in the following datalines. 

 

1   2   3

4   5   6

7   8   9

 

I am having trouble with the multiples observations per record. How do I account for the 3 space delimiter in between each observation? 

 

 

Thank you! 

2 REPLIES 2
Kurt_Bremser
Super User

Just use a double hold indicator in the INPUT statement:

data want;
input initial $ before after @@;
DATALINES;
H 11 14   H  1 10   H 10 18   J  3  2   
S  2 22   S  2 16   T  6 23   R  7  4   
;
ballardw
Super User

List input doesn't care how many delimiters there are by default, multiple delimiters, i.e. spaces, are treated as one "separation". If your actual data doesn't have the spaces now that would be a different question.

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

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 2 replies
  • 668 views
  • 0 likes
  • 3 in conversation