Import a text file

Hi, I am a new user in gams and I am trying to import a txt file, but I get the same errors (error 140 & error 36) in the first lines of my txt file again and again.
Could anyone help?

My code goes like this, and I have also attached the txt file

  • define the set of asset classes

set n Number of returns /n1*n120/;

  • define Tables, Parameters, Scalars

Scalar T /120/;


$INCLUDE prices.txt
prices.txt (1.04 KB)

Hi,

You need to declare your parameter (put “parameter” in front). Also, add the set-elements on the same row as the values, then GAMS knows which values belong to which set-elements.

parameter prices(n)/
n1     4522,
n2     4395
/;

See also: https://www.gams.com/35/docs/UG_DataEntry.html section Parameters.

Cheers,
GFA