Translating Data Between GEMPACK and GAMS

GAMS is used widely for general equilibrium modelling. It is fairly easy to convert data between GEMPACK Header Array (HAR) and GAMS formats. A complication is that there are two different types of GAMS data file:

Converting between HAR and GDX formats

Recent versions of ViewHAR let you open or "save as" either HAR or GDX files (remember to choose the extended, "advanced or editing" menu).

Command-line utilities GDX2HAR and HAR2GDX written by Mark Horridge and Tom Rutherford translate between GAMS' Data Exchange format(.GDX files) and GEMPACK Header Array files (.HAR files). These command line programs require neither a GAMS nor GEMPACK licence. Slightly different versions of the 2 programs are included in both GAMS and GEMPACK installs. You can also download the latest versions from this website here (this package also includes helpfiles and examples). Older versions are here.

Problems may arise when using older versions of GDX2HAR and HAR2GDX with newer-format GDX or HAR files -- described here.

Converting between HAR and text-based GAMS data

You can use utilities written by Tom Rutherford and Ken Pearson.

From HAR to GAMS(text)

The GEMPACK program SEEHAR can be used to convert data on a GEMPACK Header Array file to a GAMS-style file. You can download a version of SEEHAR which runs on Windows PCs. To convert a GEMPACK Header Array to a GAMS file, select option GMS when you run SEEHAR. There are a couple of different variants of this. To find out about these, respond


which will give help about the different GAMS conversion options.

There are also HAR2GAMS utilities available. [These are essentially just SEEHAR as described earlier.]

From GAMS(text) to HAR

You can download the GAMS2HAR utilities for doing this conversion. These GAMS2HAR utilities must be used with a version of GAMS.