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