Hi All, and thanks in advance!!!
I recently found out that my File Writer transformation is outputting blank spaces instead of nulls. I need it to be nulls.
Again, thank you for any help you might give this SAS newbie!!!
-Josh
Hi Josh - if you're happy with a custom code transform you could try this macro: https://core.sasjs.io/mp__ds2csv_8sas.html
I just tested with this code:
data withnulls;
length a b c $1;
length d e f 8;
call missing(of _all_);
run;
%mp_ds2csv(withnulls,outref="%sysfunc(pathname(work))/file.csv")
data _null_;
infile "%sysfunc(pathname(work))/file.csv";
input;
putlog _infile_;
run;
And it generated this:
A, B, C, D, E, F
"" ,"" ,"" ,,,
If the blank space after the null value is a problem, we could get that removed.
Thank you for your reply, Allan.
I was able to solve it. The concatenation function works- that's what I had to use in my Put statement, right before said Put statement.
In your first photograph of the text file you are generating there are a LOT of unneeded quotes. (Why did you post a photograph of text instead of just pasting the text into a text box?) For example the values DCCC_CRJ and 88.78 have quotes around them. Neither of those values contain either commas or quotes, so there was no need to add quotes around them in the CSV file.
Did you ask DI to insert all of those unneeded quotes? If so why? How?
Can you show what actual SAS code DI generated to create the CSV file?
Thank you for your reply, Tom.
I was able to solve it. The concatenation function works- that's what I had to use in my Put statement, right before said Put statement.
So you got it to work?
Note: You posted photographs of text again.
And you didn't answer why you need to jump through hoops to create such a non-standard file. What is going to read the file that requires all of those unneeded quote characters?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.