How do I export only rounded numbers from GAMS to Excel?

When unloading data from GAMS to Excel with GDX, is it possible to round numbers or choose the number of decimal to be included in the Excel files?

There is no explicit option to round numbers when writing to an Excel file, but you can round within GAMS before writing the data to GDX. You could also use cell formatting in Excel to instruct Excel to show you a certain number of digits. The following will round the parameter abc to two decimal places and export it to Excel:

$if NOT set fn $set fn 'abc'
set i /i1*i3/;
parameter abc(i);
abc(i)=normal(0,1);
abc(i) = round(abc(i),2);
display abc;
execute_unload '%fn%.gdx', abc;
execute 'gdxxrw %fn%.gdx par=abc rng=a1';