BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASFanTodd
Calcite | Level 5


I have this simple data set that I want to create a pipe delimited .txt file but I'm getting 2 added end-of-record/carriage returns in the file.  I'll try to supply all the necessary data/code so any help would be appreciated.  I'm still fairly new to SAS.

Simple Data Set (no imbedded CR or LF that I can see) output is called CSMOUT1_SUM

CNTR          TOT_CHARGE          TOT_PAID

150425          53,574,833.43          21,162,557.11

Code to create simple .txt file

DATA CSMOUT1_SUM2 (KEEP=CNTR TOTCHARGES TOTPAID);

          SET CSMOUT1_SUM;

          TOTCHARGES=PUT(TOT_CHARGE, COMMA13.2);

          TOTPAID=PUT(TOT_PAID, COMMA13.2);

RUN;

/* */

ODS LISTING CLOSE;

ODS CSV FILE='TESTOUT.TXT' OPTIONS(DELIMITER='|');

PROC REPORT DATA=CSMOUT1_SUB2 NOHEADER;

RUN;

ODS CSV CLOSE;

The output I get looks like the following when I look at the file in wordpad: (The CRLF are the added carriage returns that I'm getting)

150425|53574833.43|21162557.11 CRLF

CRLF

CRLF

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

proc export data=CSMOUT1_SUM2 outfile='TESTOUT.TXT' DBMS=DLM delimiter='|' replace;run;

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

Did you try PROC PRINT instead of PROC REPORT.  Doesn' t look like you are doing anything that needs PROC REPORT functionality.

SASFanTodd
Calcite | Level 5

I tried PROC PRINT as well.  I dont want the headers and I was aware of the option in PROC REPORT so thats what I used.  Anyway, PROC PRINT produces extra carriage returns as well.  Could it be a global setting in Options or somthing?

ballardw
Super User

proc export data=CSMOUT1_SUM2 outfile='TESTOUT.TXT' DBMS=DLM delimiter='|' replace;run;

SASFanTodd
Calcite | Level 5

Thanks ballardw!,

That is closer....now I only have 1 extra carriage return at the end instead of 2 so it looks like the following.

150425|53574833.43|21162557.11 CRLF

CRLF

There must be a way to not have the headers either I'm sure using PROC EXPORT....I can figure that part out.

Update

I got the headers out via "putnames=no"


I believe this is how the .txt file is to look - Thanks to all for the help

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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