*! version 1.0.1 21aug2026

Title

gvar use -- read a fitted GVAR back from disk

Syntax

gvar use filename [, clear nosummary]

options

clear replace a model already in memory.

nosummary suppress the description of what was loaded.

If filename has no suffix, .gvar is added.

Description

gvar use restores a model written by gvar save and
reports its dimensions and how far through the workflow it had got. After it,
every post-estimation and dynamic-analysis subcommand behaves exactly as it
did in the session that saved the model.

It does not touch the dataset in memory, and it does not need one.

Options

filename is required. The extension .gvar is assumed if none is given.

clear allows a model already in memory to be replaced. Without it, an
existing model is an error -- reading a file over a model you were still using is
not something to do silently.

nosummary suppresses the report.

The Mata engine is compiled before the file is read, because restoring a saved
structure requires its type to be known first. That happens automatically; it is
mentioned only because it is why gvar use takes a moment on a cold session.

Remarks

It will not silently overwrite. If a GVAR is already in memory,
gvar use stops with an error rather than replacing it, because losing an
unsaved model to a mistyped filename is expensive. Add clear, or run
gvar clear first.

The dataset in memory is irrelevant. The restored model carries its own
copy of everything it needs. You can load the saved model over an unrelated
dataset, or over no dataset, and the results are identical to the ones the
original session produced -- bit for bit, not approximately.

If it refuses to load, the file was written by a version of the package
whose internal structure differs from the installed one. Re-run the do-file
that estimated the model and save it again. This is the reason to keep that
do-file.

Examples

Restore and carry on

. clear all
. gvar use demo_fitted
. gvar describe
. gvar irf, shock(usa:r) response(*:y) step(24)

Replace whatever is in memory

. gvar use demo_fitted, clear

Loop over saved specifications

. foreach f in base altweights longlags {
. gvar use `f', clear nosummary
. quietly gvar irf, shock(usa:r) response(euro:y) step(24) nosummary
. matrix R_`f' = r(irf)
. }

Stored results

gvar use stores the following in r():

r(N) units

r(K) endogenous variables

r(T) periods

r(estimated) 1 if the country models are estimated

r(solved) 1 if the GVAR is solved

Source

Utility command; see gvar save.

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane