I am using the File Reader transformation in DI Studio to import a pipe delimited text file. Some of the fields contain quotes, and I ant to remove the dsd option from the generated code so that the quotes are not seen as delimiters. The problem is I can't find the option in the transformation to do this! Any suggestions?
DSD is what will remove the quotes.
filename mydata temp;
data _null_;
file mydata;
put '1|"ABC"||3';
put '2||"XYZ"|4';
run;
data demo;
infile mydata missover dsd dlm='|';
input vara varb :$3. varc :$3. vard;
run;
proc print data=demo;
run;
I don't have DI "at hand" to test it but I believe the file reader should allow you a definition that will generate code as in above infile statement.
You can also always add additional option in the text field of the file reader. Whatever you write there will just get added to the infile statement.
I've used in the past this field also for some "code ingestion" like...
; input @: _infile_=compress(_infile_,'"');
Such code would get added right after the INFILE statement but prior to the INPUT statement and though would remove double quotes before you start mapping the input buffer to variables.
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.