Dynare code to count the number of exogenous and endogenous variables

I am working on a .mod file that has a very large number of exogenous and endogenous variables. I am working on a model similar to DSGE where we define about 10 equations for each of the 30 countries in the system (for example). The equations determine the paths of the federal funds rate, unemployment rate, etc. These are the endogenous variables. Is there any code that I can type in Dynare to count the number of endogenous and exogenous variables? On a related note, is there a code that I can type to count the total number of equations for all countries defined in the system in Dynare?

What do you mean with “count variables”? Are you getting an error message at the preprocessing stage? Generally, when doing multi-country work, you should use the macro-processor to automatize that process. See e.g. examples/bkk.mod · master · Dynare / dynare · GitLab

Hi, thanks for the link. Its helpful. So far, my model has for loops that add each country’s equation one below the other, but I’ll definitely try what you sent in the link. There was no error while preprocessing. The error occured while computing the steady states using the “steady” command. I tried various optimization techniques that we can try in solve_algo in the steady command, but none of them worked. So, I thought of checking if the system of equations is correct, such as if the number of equations is same as the number of endogenous variables. This is the reason I asked if there is a dynare code to check that, simply because the the model itself is very large.

However, since it didn’t show any error in preprocessing, does it mean that the number of endogenous variables must be equal to the number of equations? Is there anything else that I should look for to ensure that I am able to compute the steady state?

Dynare automatically checks whether the number of equations matches the number of variables. Otherwise, you will get an error. Generally, for large models I recommend providing an analytical steady state. In any case, make sure your equations are correctly entered. For that, I usually recommend using Dynare’s \LaTeX-features.

I was able to get the steady states in a smaller model with only 4 countries, but when I increase the number of countries to more than 4, Dynare prints an error that the Blanchard Kahn conditions aren’t satisfied. You mentioned in one of your solutions to previous posts that this arises due to a timing error in at least one of the state (predetermined) variables. Since the model successfully worked for 4 countries and less, I thought that the equations are correct, but could it be the case that they are still incorrect? Any other reason that could cause this? Or could it be a country-specific problem?

Is the model symmetric? If not, it can be country-specific.

By symmetric model do you mean that equations are not the same for all countries?

I meant symmetric in terms of parameters. Adding similar countries should not alter the determinacy properties.

So, do you mean that the parameters for every country must be the same? For instance, let’s say that beta1 is a parameter in the interest rate equation. Then. the parameters beta1_countryA = beta1_countryB, and the same is true for all parameters in other equations for the model to be symmetric?

Yes, that’s what people typically mean with symmetric. All equations and parameters are structurally the same across countries.

I see. Thanks a lot