BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

Isnt the code

dsd dlm = ' | '    the method to help avoid excess characters, in this case excess | when using proc export to .txt.

Here is my fields in the dataset

LOAN       CLOSING_DATE     DEFAULT_REASON  LAST_NAME    EMAIL

Desired output

111111119|05/15/2014|Layoff|Shelton|shelton@gmail.com

Instead I get this

111111119|05/15/2014||||||||||||Layoff||||||||||||||

Shelton|shelton@gmail.com

I get extra  | and the word jump to the next line.  The Loan number should always begin the proc export.

4 REPLIES 4
Hima
Obsidian | Level 7

Code:

data have;
input LOAN  $     CLOSING_DATE  $10.   DEFAULT_REASON $ LAST_NAME  $  EMAIL$25. ;
datalines;
111111119 05/15/2014 Layoff Shelton shelton@gmail.com
;

proc export data=have
   outfile='/sasuserhome/hyenigalla/have.txt'
   dbms=dlm;
   delimiter='|';
run;

Output:

Capture.JPG

ballardw
Super User

Going to another line may mean that your field Last_namel contains control characters such as a carriage return or line feed.

Also you may want to post the entire proc export code to see if any options are interacting.

Haikuo
Onyx | Level 15

Without seeing your actual data and your code, it is difficult to debug. I can't repeat your issue, below code works for me:

proc export data=sashelp.class

outfile="h:\temp\class_pipe1.txt"

dbms=dlm replace;

delimiter='|';

putnames=yes;

run;

Haikuo

ballardw
Super User

Another thing to look at if this data was originally imported from Excel: if the source file has HIDDEN columns you may have imported a bunch of blank columns that would have names like Var1 Var2 Var3. Export would produce a delimiter between each of those fields. If you don't have the PUTNAMES=YES as part of the proc export you won't notice as no column headings would appear.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 6397 views
  • 0 likes
  • 4 in conversation