Real number expected error when trying to import data

Hello,

I am trying to import the following data into my gams model:


dummy
material descr
1 001111 cosmone01
2 001112 cosmone02
3 001113 cosmone03
4 001114 cosmone04
5 001115 cosmone05
6 001116 cosmone06
7 001117 cosmone07
8 001118 cosmone08
9 001119 cosmone09

10


001120


cosmone10

My GAMs code is the following:

set y ‘number’ /
call =sql2gms C="DSN=IngTest" Q="select distinct(dummy) from [sheet1]" O=“U:\Desktop\LotSizeGams\test.inc”
$include U:\Desktop\LotSizeGams\test.inc
/;
display y;

set f ‘material’ /
call =sql2gms C="DSN=IngTest" Q="select distinct(material) from [sheet1]" O=“U:\Desktop\LotSizeGams\material.inc”
$include U:\Desktop\LotSizeGams\material.inc
/;
display f;

parameter product(y) /
call =sql2gms C="DSN=IngTest" Q="select dummy, material from [sheet1]" O=“U:\Desktop\LotSizeGams\all.inc”
$include U:\Desktop\LotSizeGams\all.inc
/;
display product;

parameter ingredient(y) /
call =sql2gms C="DSN=IngTest" Q="select dummy, descr from [sheet1]" O=“U:\Desktop\LotSizeGams\descr.inc”
$include U:\Desktop\LotSizeGams\descr.inc
/;
display ingredient;

However I get the following error when I try to read the data for the ingredient parameter:

— pfizerV8-2-Int-V01-recurse-excel-calculation-work-in-progress.gms(117) 3 Mb
— .descr.inc(12) 3 Mb 1 Error
*** Error 1 in U:\Desktop\LotSizeGams\descr.inc
Real number expected

Do you have an idea of what I may be doing wrong?

Thank you, Cheers,
Hugo



\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/OWBfodtUcFsJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hugo
Parameters must be associated in the following way:
set_index value (real number)

if a parameter depends on 2 sets, as XX(i,j), it must be expressed this way:

1.1 500
1.2 200
2.1 1000
2.2 2000

and so on.

You should not put the description in 3rd column.
Regards

2012/10/29 Hugo Caçote

Hello,

I am trying to import the following data into my gams model:


dummy


material descr

1 001111 cosmone01
2 001112 cosmone02
3 001113 cosmone03
4 001114 cosmone04
5 001115 cosmone05
6 001116 cosmone06
7 001117 cosmone07
8 001118 cosmone08
9 001119 cosmone09

10




001120




cosmone10

My GAMs code is the following:

set y ‘number’ /
call =sql2gms C="DSN=IngTest" Q="select distinct(dummy) from [sheet1]" O=“U:\Desktop\LotSizeGams\test.inc”
$include U:\Desktop\LotSizeGams\test.inc
/;
display y;

set f ‘material’ /
call =sql2gms C="DSN=IngTest" Q="select distinct(material) from [sheet1]" O=“U:\Desktop\LotSizeGams\material.inc”
$include U:\Desktop\LotSizeGams\material.inc
/;
display f;

parameter product(y) /
call =sql2gms C="DSN=IngTest" Q="select dummy, material from [sheet1]" O=“U:\Desktop\LotSizeGams\all.inc”
$include U:\Desktop\LotSizeGams\all.inc
/;
display product;

parameter ingredient(y) /
call =sql2gms C="DSN=IngTest" Q="select dummy, descr from [sheet1]" O=“U:\Desktop\LotSizeGams\descr.inc”
$include U:\Desktop\LotSizeGams\descr.inc
/;
display ingredient;

However I get the following error when I try to read the data for the ingredient parameter:

— pfizerV8-2-Int-V01-recurse-excel-calculation-work-in-progress.gms(117) 3 Mb
— .descr.inc(12) 3 Mb 1 Error
*** Error 1 in U:\Desktop\LotSizeGams\descr.inc
Real number expected

Do you have an idea of what I may be doing wrong?

Thank you, Cheers,
Hugo



\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/OWBfodtUcFsJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Edson Valle
edsoncv@gmail.com


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hello Edson,

Thank you for the reply… I think I understands now.

Is there anyhow to keep in GAMS language data structures (parameters, tables, sets …) information that is a string and not a number?

Thank you. Cheers,
Hugo


On Monday, 29 October 2012 15:42:13 UTC+1, Edsoncv wrote:

Hugo
Parameters must be associated in the following way:
set_index value (real number)

if a parameter depends on 2 sets, as XX(i,j), it must be expressed this way:

1.1 500
1.2 200
2.1 1000
2.2 2000

and so on.

You should not put the description in 3rd column.
Regards

2012/10/29 Hugo Caçote

Hello,

I am trying to import the following data into my gams model:


dummy


material descr

1 001111 cosmone01
2 001112 cosmone02
3 001113 cosmone03
4 001114 cosmone04
5 001115 cosmone05
6 001116 cosmone06
7 001117 cosmone07
8 001118 cosmone08
9 001119 cosmone09

10




001120




cosmone10

My GAMs code is the following:

set y ‘number’ /
call =sql2gms C="DSN=IngTest" Q="select distinct(dummy) from [sheet1]" O=“U:\Desktop\LotSizeGams\test.inc”
$include U:\Desktop\LotSizeGams\test.inc
/;
display y;

set f ‘material’ /
call =sql2gms C="DSN=IngTest" Q="select distinct(material) from [sheet1]" O=“U:\Desktop\LotSizeGams\material.inc”
$include U:\Desktop\LotSizeGams\material.inc
/;
display f;

parameter product(y) /
call =sql2gms C="DSN=IngTest" Q="select dummy, material from [sheet1]" O=“U:\Desktop\LotSizeGams\all.inc”
$include U:\Desktop\LotSizeGams\all.inc
/;
display product;

parameter ingredient(y) /
call =sql2gms C="DSN=IngTest" Q="select dummy, descr from [sheet1]" O=“U:\Desktop\LotSizeGams\descr.inc”
$include U:\Desktop\LotSizeGams\descr.inc
/;
display ingredient;

However I get the following error when I try to read the data for the ingredient parameter:

— pfizerV8-2-Int-V01-recurse-excel-calculation-work-in-progress.gms(117) 3 Mb
— .descr.inc(12) 3 Mb 1 Error
*** Error 1 in U:\Desktop\LotSizeGams\descr.inc
Real number expected

Do you have an idea of what I may be doing wrong?

Thank you, Cheers,
Hugo



\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/OWBfodtUcFsJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Edson Valle
eds...@gmail.com


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/eSqZY9vCSdwJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hugo
A set itself is a group/sequence of anything, can be a city name, a sequence of numbers, etc, maybe is what you need. It is just to be used as an index.
A parameter is associated with sets (can be more than one) an needs to be a number that will be used by Gams in calculations.
A table is a special case of 2 dimensional parameter.

I suggest you to take a look at GAMS manual to understand better the definition of a set, parameter, tables, etc.
I also suggest that you take a look at GAMS data utility in the ‘model libraries’ menu at GAMS Ide.


Regards

2012/11/1 Hugo Caçote

Hello Edson,

Thank you for the reply… I think I understands now.

Is there anyhow to keep in GAMS language data structures (parameters, tables, sets …) information that is a string and not a number?

Thank you. Cheers,
Hugo


On Monday, 29 October 2012 15:42:13 UTC+1, Edsoncv wrote:

Hugo
Parameters must be associated in the following way:
set_index value (real number)

if a parameter depends on 2 sets, as XX(i,j), it must be expressed this way:

1.1 500
1.2 200
2.1 1000
2.2 2000

and so on.

You should not put the description in 3rd column.
Regards

2012/10/29 Hugo Caçote

Hello,

I am trying to import the following data into my gams model:


dummy


material descr

1 001111 cosmone01
2 001112 cosmone02
3 001113 cosmone03
4 001114 cosmone04
5 001115 cosmone05
6 001116 cosmone06
7 001117 cosmone07
8 001118 cosmone08
9 001119 cosmone09

10




001120




cosmone10

My GAMs code is the following:

set y ‘number’ /
call =sql2gms C="DSN=IngTest" Q="select distinct(dummy) from [sheet1]" O=“U:\Desktop\LotSizeGams\test.inc”
$include U:\Desktop\LotSizeGams\test.inc
/;
display y;

set f ‘material’ /
call =sql2gms C="DSN=IngTest" Q="select distinct(material) from [sheet1]" O=“U:\Desktop\LotSizeGams\material.inc”
$include U:\Desktop\LotSizeGams\material.inc
/;
display f;

parameter product(y) /
call =sql2gms C="DSN=IngTest" Q="select dummy, material from [sheet1]" O=“U:\Desktop\LotSizeGams\all.inc”
$include U:\Desktop\LotSizeGams\all.inc
/;
display product;

parameter ingredient(y) /
call =sql2gms C="DSN=IngTest" Q="select dummy, descr from [sheet1]" O=“U:\Desktop\LotSizeGams\descr.inc”
$include U:\Desktop\LotSizeGams\descr.inc
/;
display ingredient;

However I get the following error when I try to read the data for the ingredient parameter:

— pfizerV8-2-Int-V01-recurse-excel-calculation-work-in-progress.gms(117) 3 Mb
— .descr.inc(12) 3 Mb 1 Error
*** Error 1 in U:\Desktop\LotSizeGams\descr.inc
Real number expected

Do you have an idea of what I may be doing wrong?

Thank you, Cheers,
Hugo



\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/OWBfodtUcFsJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Edson Valle
eds...@gmail.com


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/eSqZY9vCSdwJ.

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Edson Valle
edsoncv@gmail.com


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.