Hi all,
I'm currently have a model that is running on a loop to test several configurations on different scalar/parameters.
Different set of configurations = different results that I want to store and analyse later
On a single run, I can export a csv file with detail results from GAMS.
When I try to run it on a loop i get " 349 Declaration not allowed inside a LOOP or IF statement" message
is there an alternative to this ?
Thanks
Paulo
Export result (CSV) in a loop
Re: Export result (CSV) in a loop
It would help if you post the related source lines that create this error. I assume you try to declare a put file inside the loop and somehow use the loop set index as a file name. That's not possible, but with the put_utility 'ren' (https://www.gams.com/37/docs/UG_Put.html#UG_Put_PutUtil) you can rename the put stream inside the loop:
Creates three CSV files 1.csv, 2.csv, and 3.csv.
-Michael
Code: Select all
file fcsv / x.csv /; put fcsv;
set i /1*3/;
loop(i,
put_utility 'ren' / i.tl:0 '.csv';
put fcsv 'a,b,c', / i.val,(i.val+1),(i.val+2);
);
-Michael