How to Read Results in a GDX File
Download a PDF version of this how-to-guide here:
1. What is a GDX File?
2. Where is the UNI-Results.GDX File?
Figure 1. Set GAMS to create a GDX
results file after running the model
After you run the model, the UNI-RESULTS.GDX file will appear on the Project Explorer list. Click on its name to open it.
After you open it, the file name will appear on the menu bar (Figure 2). You can leave the file open, and results from subsequent experiments will constantly overwrite it.
Figure 2. UNI-RESULTS.GDX listed on the menu bar
3. What is in the UNI-Results.GDX File?
The GDX file reports the solution values for selected variables and parameters in the model. Figure 3 presents a snippet of the UNI-RESULTS.GDX file.
Figure
3. Example of the contents of the UNI-RESULTS.GDX
file
Clicking on the
name of an item in the left-hand column opens the data for that item in the
right-hand section of the screen. In Figure 3, the modeler had previously
created and defined a parameter named “RES_PCOM_PC” in the UNI-CGE model code.
It is a table of RESults
for Percentage Changes
in Quantities
of COMmodities,
such as aggregate consumption (QQ). After selecting this parameter for
display, the data on the right are the values for these results.
4. Export Results from GDX to Excel
The GAMS code in the UNI-CGE model first unloads selected results into the
UNI-Results.GDX file, and then exports those results from the GDX file to the
Excel file named UNI-results.XLSX (Figure 4).
This process uses GAMS’ read-write utility between GAMS and Excel,
GDXXRW.
Figure 4. Exporting results to GDX file,
and then to the Excel using GDXRW
Because the GDXXRW utility may become unsupported by GAMS
in the future, this guide also shows you a direct way to export results from
GDX to Excel.
First, while in the GDX file, click on the EXPORT button (shown as the red
circle labeled 1 in
Figure 5).
Second, this opens a dialog box, shown on the right side of Figure 5. Select the name of the Excel file that you want to export results to, shown in the purple circle labeled 2 in Figure 5. The default name is the same as the GDX file. Instead, you may want to create Excel files that have the names of scenarios, such as “tariff_cut.xlsx.”
Third, click on the export button, labeled “3”.
Figure 5. Exporting results from GDX to an Excel file
The UNI-CGE model code includes commands to organize key results into tables. This makes it easier to view sets of related data instead of single variables or parameters. Table 1 provides a summary of the tables defined in the UNI-CGE model and their contents.
Content |
|
Res_QCOM_pc |
% change in commodity quantities (production, consumption, trade) |
Res_PCOM_pc |
% change in commodity prices |
Res_PROD_pc |
% change in production quantity and value added |
Res_SCAL_pc |
% change in scalar values (macro variables) |
RGTAPtab_pc |
% change in real GDP |
FACT_pc |
% change in factor results |
QF_pc |
% change in factor quantities by factor and activity |
WFA_pc |
% change in factor price distortion by factor and activity |
CTAXR_B |
Base commodity tax rates (sales, export and import taxes) |
CTAXR_L |
Updated commodity tax rates (sales, export and import taxes) |
ATAXR_B |
Base activity output tax rates |
ATAXR_L |
Updated activity output tax rates |
YTAXR_B |
Base income tax rate |
YTAXR_L |
Updated income tax rate |
GDX allows you to rearrange the orientation of tables of data so
that you can easily format data to be attractive when exported to Excel. “List view” presents the data in
columns. “Table view” presents the same
data as a matrix, as shown in Figure 3.
You can toggle between list and table views by clicking on the button
located above the data (Figure 6).
Figure 6. GDX data presented in table view

Copyright Cornerstone CGE 2024 CC 4.0 BY-NC-SA