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
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
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.