DATA Step, Macro, Functions and more

DI Studio, can I remove quotes in file created by File Writer

Reply
New Contributor
Posts: 2

DI Studio, can I remove quotes in file created by File Writer

I wanna create a file based on data in a SAS table, using the File Writer transform in DI Studio.

The generated code contains logic to enclose every variable in "-characters (qoutes).  This is not what I want.  Is there any way to remove these quotes?

The part of the code that is responsible for this looks something like this: (it is the quote variable that is responsilbe for this printing of quotes)

      quote='"';

      file "&FILENAME_CATO_AGG." TERMSTR=CRLF dlm=' ';
     
         put
            quote +(-1) ReportDate +(-1) quote
            quote +(-1) FolderName +(-1) quote
           ;

run;

Super User
Posts: 10,466

Re: DI Studio, can I remove quotes in file created by File Writer

Remove the
"quote +(-1)" and "+(-1) quote" surrounding each of your variables that appear in the PUT statement. The +(-1) parts are there to snuggle the quotes against the values.

New Contributor
Posts: 2

Re: DI Studio, can I remove quotes in file created by File Writer

Well, my question wasn't really how to change the code to do what I want, but instead how to make DI Studio generate code that does what I want....

I can certainly change the code, but that would mean that I would not use the File Writer transform of DI Studio anymore, which is something that I want to continue (if possible) to do.  If I instead write the code directly I get into lots of maintainability issues in our system, which is primarily built using DI Studio.

So, to restate the question more clearly:  Can I make DI Studio generate code that does not put quotations around everything that is written to the file?

SAS Employee
Posts: 5

Re: DI Studio, can I remove quotes in file created by File Writer

You must select "Treat consecutive delimiters as a single delimiter" in the external file properties (File Parameters tab) to prevent the double quotation marks from being included in the data.

Senior User
Posts: 1

Re: DI Studio, can I remove quotes in file created by File Writer

This only works if you know your dataset doesn't have empty columns; if it does, then setting that option makes things worse, as the incoming data aren't read properly.  unless, i suppose, we have separate metadata for the file being written an the file being output?

Ask a Question
Discussion stats
  • 4 replies
  • 1096 views
  • 1 like
  • 4 in conversation