BookmarkSubscribeRSS Feed
AmitKB
Fluorite | Level 6
Hi Everyone,
I am trying to read comma delimited text file. The SAS dataset reads a "square sign" in the last column. How do I get rid of it.

infile '/path/data.txt' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;

Thanks,

Amit
3 REPLIES 3
Doc_Duke
Rhodochrosite | Level 12
It's likely the end-of-line character for a record from the PC .csv file that was copied to Unix. Check out this thread:

http://support.sas.com/forums/message.jspa?messageID=20381#20381

If that is not it, tell us more about your platform and the data sources.
data_null__
Jade | Level 19
You could add the INFILE option TERMSTR with no need to fiddle with the input file(s).

[pre]
infile ..... termstr=crlf;
[/pre]
Peter_C
Rhodochrosite | Level 12
add '0A'x as delimiter on infile.[pre]infile '/path/data.txt' delimiter= '2c0d'x MISSOVER DSD lrecl= 32767 firstobs= 2 ;[/pre]Then if any '0D'x disappear, the ''0A'x on its own will still act as a line terminator.

PeterC

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 816 views
  • 0 likes
  • 4 in conversation