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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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