BookmarkSubscribeRSS Feed
Jim_Cooper_hmsa
Obsidian | Level 7

 A business partner requires a pipe-delimited (|) record format where missing values are represented as a zero length field or two consecutive pipe characters (||).  We have tried formats, compress() function, and system option MISSING='' to force length zero for missing values in a PUT statement but the record always returns a single blank space between two pipe characters (| |).  Is there a way to remove the single blank space for output without having to remove blank spaces after the file is created with a utility program (e.g. PowerShell)?  We are trying to automate this process if possible.

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hello @Jim_Cooper_hmsa,

 

Add the DSD option to the FILE statement.

 

Example:

93    data _null_;
94    file log dlm='|' dsd;
95    x='ABC';
96    y=' ';
97    z='DEF';
98    m=.;
99    n=123;
100   put x y z m n;
101   run;

ABC||DEF||123
NOTE: DATA statement used (Total process time):

The same code without the DSD option yields

ABC| |DEF|.|123

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 345 views
  • 9 likes
  • 2 in conversation