@Adumb wrote:
I'm new to this group and I'm hoping this is a one-off request. I send the file off to a different team so I'm not sure what they're using. I will certainly be asking more questions.
Yes, this is the desired output:
"abc"|""|"ghi"
Currently I'm getting this:
"abc"|" "|"ghi"
You can also try giving them a file that does not have any of the unnecessary quotes.
abc||ghi
There is no reason to have quotes unless the value contains the delimiter (or quotes).
You could try making your own format that writes blank as bare quotes and then use that without the DSD option.
Example:
proc format;
value $equote (max=32767)
' '='""'
other=[$quote.]
;
run;
data test;
infile cards dsd truncover;
input (c1-c3) (:$30.) n1-n3 ;
file log dlm=',';
format _character_ $equote.;
put c1-c3 n1-n3 ;
cards;
1,2,3,4,5,6
a,b,,7,,9
;
Results:
"1","2","3",4,5,6 "a","b","",7,.,9
If the requirement is just to quote the character values, and not the numeric values, then try ODS CSV. You can use teh DELIMITER option to ask it to use | instead comma.
ods csv file=csv options(delimiter='|');
options missing=' ';
proc print data=test; run;
ods csv close;
options missing='.';
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.