09-22-2014 12:27 PM
Does anyone know by any chance how to export a txt file with double quotes and when the text field is blank it be
exported as ""?
I would like to export a txt file like this:
09-22-2014 01:29 PM
Jaap's suggestion certainly works. Here is an alternative, You will need 'FILENAME' statement to address your destination instead of 'LOG':
infile cards truncover;
input (field1 field2 field3) (:$8.);
file log dsd dlm=';';
put field1 ~ field2 field3 ~;
abc 123 XXX
def 456 .
ghi 654 YYY
09-23-2014 09:02 AM
I don't know of a symbol for single quotes. You could do the single quoting with the quote function but you much also make sure the character variables have adequate to hold the two or more characters that will be added to the value. This would be easier if there were an $SQUOTE function similar to $QUOTE then you would not have the length problem. I suppose $SQUOTE could be written using PROC FMCP, we can leave that for another time.
09-23-2014 08:37 AM
data have; input field1 $ field2 field3 $; cards; abc 123 XXX def 456 . ghi 654 YYY ; run; ods listing close; ods csv file='c:\temp\y.txt' options(doc='help' Delimiter=';'); proc print data=have label noobs;run; ods csv close; ods listing;
Another way :
%ds2csv (data=have, runmode=b, csvfile=c:\temp\retail.csv);