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.
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.