BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Emma8
Quartz | Level 8
Hi. I have very large datasets (Csv)—some variables have line breaks —how can I fix those random line breaks when I import into sas?thank you.
1 ACCEPTED SOLUTION
4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

Please try the FILENAME statement option TERMSTR. 

 

filename sample 'sample.csv' termstr=CRLF;

proc import datafile=sample out=csv replace dbms=csv;
run;
Thanks,
Jag
ChrisNZ
Tourmaline | Level 20

>some variables have line breaks

This is insufficient information.

Are these LF or CRLF ? How do the breaks show in Notepad++ or in MS Word?

Patrick
Opal | Level 21

Having LF in .csv created from Excels is unfortunately not uncommon. Luckily your .csv will most likely use CRLF as actual end-of-line indicator.

If so then using termstr=CRLF in the Infile statement should be the silver bullet for you.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2429 views
  • 3 likes
  • 5 in conversation