BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mona4u
Lapis Lazuli | Level 10

I need to know how to output data as txt pipe delimited in sas

1 ACCEPTED SOLUTION

Accepted Solutions
Amir
PROC Star

Hi,

 

A web search for "how to create a delimited file site:sas.com" brought back the following:

 

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000316290.htm

 

http://support.sas.com/kb/24/596.html

 

They should be of help, but if you need something else then please provide more detailed information.

 

 

Regards,

Amir.

View solution in original post

6 REPLIES 6
ballardw
Super User

Easiest would be Proc export with DBMS=dlm and a Delimiter='|';

 

proc export data=sashelp.class
   outfile="c:\myfiles\class"
   dbms=dlm replace;
   

   delimiter='|';
 run;

or the export wizard.

 

mona4u
Lapis Lazuli | Level 10

i tried this code

ods csvall file="&output\A678_20110265_irrc_recist_NL_2018Jul18.txt" options(delimiter='|');
title;
proc print data=irr_nl_1 noobs; run;
ods csvall close;

 

but it gave me " " in the character variables 

Reeza
Super User

@mona4u wrote:

i tried this code

ods csvall file="&output\A678_20110265_irrc_recist_NL_2018Jul18.txt" options(delimiter='|');
title;
proc print data=irr_nl_1 noobs; run;
ods csvall close;

 

but it gave me " " in the character variables 


That's common in data structures, avoid having to deal with records that could have an embedded pipe symbol in it. If you don't want that you'll have to likely write a data _null_ step instead to manually export it. 

 

I believe the links someone else provided demonstrates how to do that.

mona4u
Lapis Lazuli | Level 10

it didn't work 

Reeza
Super User

@mona4u wrote:

it didn't work 


This is not helpful. How did it not work? What does that mean? What did you try and what errors did you get? 

The code posted worked fine for me, so you likely implemented it incorrectly or have not specified your requirements in enough detail so we don't actually know what you want. 

 

 

 

Amir
PROC Star

Hi,

 

A web search for "how to create a delimited file site:sas.com" brought back the following:

 

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000316290.htm

 

http://support.sas.com/kb/24/596.html

 

They should be of help, but if you need something else then please provide more detailed information.

 

 

Regards,

Amir.

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
  • 6 replies
  • 20245 views
  • 4 likes
  • 4 in conversation