0

i am very new to GAMS and im trying to understand how sets work while importing from CSV and what im doing wrong. I have data as in picture below (prices_wide_example.csv), i would like to import it in p_wide, with sets (iso, tar, var).

Set iso, tar, var;
Set y /1990*1993/;
Parameter p_wide(iso,tar,var,y);

$call csv2gdx "prices_wide_example.csv" id=p_wide index=1,2,3 values=4..lastCol useHeader=y output="prices.gdx"
execute_load 'prices.gdx', p_wide;

*display p_wide;
*display tar;
*p_wide('USA','TAR','GDP')=777


execute_unload 'prices1.gdx', p_wide;
execute 'gdxxrw prices1.gdx o=CSV_test11.xlsx par=p_wide rng=Sheet1!A1';
execute 'gdxxrw prices.gdx o=CSV_test12.xlsx par=p_wide rng=Sheet1!A1';


$exit

If i open prices.gdx i see parameter p_wide with the data, but first three columns have no labels iso, tar, var. Also seems like i am not loading the data, so when exporting CSV_test11 is empty, and CSV_test12.xlsx has the data (without col names). Commented out lines give error too. What am i doing wrong?enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.