BookmarkSubscribeRSS Feed
FredrikFerm
Calcite | Level 5

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;

4 REPLIES 4
ballardw
Super User

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.

FredrikFerm
Calcite | Level 5

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?

TwanManders
SAS Employee

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.

eavesdm
Calcite | Level 5

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?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 4334 views
  • 1 like
  • 4 in conversation