I am building an economic model in GAMS, which, differently from the famous “transport” model does not call for optimization using lp or others. Usually, I just press f9 and GAMS runs it.
However, I have reached a phase where I will:

export some tables to R (I am using an Excel file as intermediate cause I have not found out how to send it directly to R - but it does not matter now),

run some analysis In R, and

Import it back to GAMS to continue the model

I wrote (in the body of the model) the gdx routine to export the files to Excel and it worked well. The import routine, however, I wrote in a separate file (also works well). When I tried to put both routines in the same file (the one containing the original model), it didn’t work as I would like.

What I want, is to divide my model into parts:

First, to run the model until the part where I export the tables

Then, to run the routine importing the tables back into GAMS

Finally, to run the rest of the model

How do I do that? Does the “solve model_name” works even for models that “are not optimizing” anything?

There is a tendency to overuse the word “model” in this area. For example, a GAMS model can be:

A bunch of GAMS code stored in a file.

A GAMS symbol denoting a collection of equations, e.g.

model m / all /;

The latter can be solved using the solve statement, but the former isn’t something to “solve” in that sense.

There are many ways to arrange your GAMS code and language features to support this. In particular, you should look at calling a separate GAMS source file from within GAMS via the ‘$call’ or ‘execute’ commands.

In particular the last example shows in general how you can export some data from GAMS to R, do some work in R, and bring new data from R back to GAMS.

Thank you all for your replies.
After reading both suggestions and consulting GAMS documentation, I think brucemccarl’s suggestion would fit my needs the best. The only problem is that I have an old version of GAMS (24.1) and apparently the save and restart does not work there. Am I right?