BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello friends

I am using proc export to export data from SAS data set into txt file.

The SAS data set contain 1,000,000 rows.

I expect that when I open the txt file in notepad then I will get also 1,000,000 rows.

However,I see that the structure of the data is different and in each row there are multiple observations.

My question: What is the way to get in txt file one observation in each row?

 

 

proc export data=ttt
outfile ="path/myreport.txt"
dbms = dlm;
delimiter = ' ';
run;
3 REPLIES 3
Kurt_Bremser
Super User

Make sure that your text file has the correct line delimiter for the target operating system. Windows Editor, for example, does not understand the UNIX LF line terminator, it needs the DOS/Windows CRLF sequence.

Since the documentation for the PROC EXPORT statement does not mention a TERMSTR= option, you will have to use a data step to write the file, where you can use TERMSTR=CRLF in the FILE statement. Copy the data step code (created by proc export) from the log and modify it.

 

If you open your text file with an editor that understands different line-ending methods (like Notepad++), you will see the correct layout and the "UNIX" designator in the status bar.

RichardDeVen
Barite | Level 11

What are the variables in your data set TTT ?  Do the character values contain control characters such as newline (0Ax), return (0Dx), or tab (09x) ?  What OS are you running SAS in ?

Tom
Super User Tom
Super User

Perhaps your SAS code is running on Unix?  Look at the file on your pc with a different program than NOTEPAD.  NOTEPAD does not recognize a bare LINEFEED as marking the end of line. It wants to see the DOS standard of carriage return followed by linefeed.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 1126 views
  • 0 likes
  • 4 in conversation