How do I: create a dynamic file name based on the set element I am looping over
175 views
Skip to first unread message
AC
unread,
Feb 6, 2012, 10:29:27 PM2/6/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gamsworld
Hi
We want to loop over a set of scenarios, and for each scenario write a
report where the filename contains the scenario. For example if I had
2 scenarios x and y I would want my report file to be report_x.csv and
report_y.csv
I think I can do this using $batlinclude, something roughly like:
loop (scenario) do
$batinclude active_file_name scenario
put "report starts here";
:
putclose;
endloop;
and the file activate_file_name.gms will simply be something like:
put report_%1
I have not actually tried the above yet to check it works [and as I
type i realise I would need something similar to do the initial file
declarations]. My question is whether there is a better/easier way to
do this?
Thanks
AndyC
Michael Bussieck
unread,
Feb 7, 2012, 2:55:29 AM2/7/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message