BookmarkSubscribeRSS Feed
raivester
Quartz | Level 8

I have a .txt file from our data provider that I am trying to read in. The file uses ! as its delimiter; and while most observations fit on a line, some observations wrap. Are there any tricks to reading this data in so that these wrapped lines do not show up as separate obseravations?

2 REPLIES 2
ballardw
Super User

Are you sure that the lines "wrap" to a new line? Some file viewers depending on settings will make it appear that a line continues on the next when it is still a single line.

 

Quick test would be to use proc import with the file and tell it to use the ! character as a delimiter and see if you get data more or less as expected.

 

The "tricks" would involve the specific files and why the wrap.

 

Patrick
Opal | Level 21

The details will make the difference. If a single logical row of data can really be written physically on two lines exactly like in below sample then FLOWOVER might do the job for you.

data demo;
  infile datalines flowover dlm='!';
  input a b c;
  datalines;
1!2!3
4!5
6
7
8!9
;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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