User Tools

Site Tools


Can I change the decimal symbol from a dot to a comma?

The short answer is no, this is not possible within GAMS. However it only becomes an issue when importing data in ASCII format (i.e. csv-files). Here is a simple example (input.csv) generated with the German regional settings of Windows:


To change the comma into a dot and the semicolon into a comma we just use one of the POSIX tools, which are part of any GAMS system and write a few lines of GAMS code:

* translate , to . using tr
$call "tr , . <input.csv >temp.csv"
* translate ; to , using tr
$call "tr ; , <temp.csv >output.csv"
table data(*,*)
$include output.csv
display data;


* translate , to . and ; to , using sed
$onecho > sedscript
$call sed -f sedscript input.csv > output.csv
table data(*,*)
$include output.csv
display data;

and get

----     14 PARAMETER data  

             new-york     chicago      topeka

seattle         2.500       1.700       1.800
san-diego       2.500       1.800       1.400
interfaces/can_i_change_the_decimal_symbol_from_a_dot_to_a_comma.txt · Last modified: 2007/09/28 14:42 (external edit)