put_utilities does not work with several print control options

Hi,

I am trying to run my code in a loop and output a .csv, where each CSV has a different name (i.e. year1.csv, year2.csv …). However, I am noticing that any of the formatted outputs (which I need for the next step of my code) do not work with put_utilities.

Specifically, the lines

put_utility ‘ren’ / ‘test.csv’ ;
contingencies.pc = 5;

clash with one another. I was wondering if this was a bug that could be fixed, or if someone could suggest a workaround. Such as another way to dynamically save each loop in a different .csv (or different sheet on an excel file).

file contingencies /file.csv/;

set yearSim /1*2/;
loop(yearSim,

put contingencies;

put_utility 'ren' / 'test.csv' ;
contingencies.pc = 5;

put 'month', 'daytype', 'hour';
putclose contingencies ;

);

Hi,

This is clearly a bug in the system (it happens with all settings for .pc which add quotes automatically). As a workaround you could set .pc=2 before the rename and set it back to 5 afterwards (note that I also used yearSim.tl in the rename command to actually generate different files, before you had just one file name):

file contingencies /file.csv/;

set yearSim /1*2/;
loop(yearSim,

put contingencies;

contingencies.pc = 2;
put_utility 'ren' / 'test' yearSim.tl:0 '.csv' ;
contingencies.pc = 5;

put 'month', 'daytype', 'hour';
putclose contingencies ;

);

Hope that helps,
Lutz

Thanks for the extremely fast reply. This is such a great (And simple!) fix. It solves my problem completely.

With much appreciation,
Zack