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?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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