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.

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

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
  • 538 views
  • 0 likes
  • 3 in conversation