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
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.