Dear all,
I have learned how to make calculations between two observations belonging to the same variable, using the [_n] and [_N] notations.
However I cannot figure the code when I need to make a calculation (for instance a percent difference) between several observations and a specific observation, all belonging to the same variable.
For instance in the below dataset
.... for each country and each year (2030 and 2050) I need to calculate the percent difference between all the scenarios and REF_ar6_NoCC
For instance for Bangladesh in 2030 I need to calculate the % difference between GFDL and REF, IPSL and REF, MPI and REF, and MRI and REF.
Same for 2050, and then the same for Cambodia in 2030 and 2050.
Any advice or suggestion is very welcome.
thanks
Nicola
I have learned how to make calculations between two observations belonging to the same variable, using the [_n] and [_N] notations.
However I cannot figure the code when I need to make a calculation (for instance a percent difference) between several observations and a specific observation, all belonging to the same variable.
For instance in the below dataset
Code:
cty Scenario Year Value Bangladesh GFDL379 2030 16,567.12 Bangladesh IPSL379 2030 16,596.36 Bangladesh MPI379 2030 16,578.25 Bangladesh MRI379 2030 16,570.33 Bangladesh REFar6_NoCC 2030 16,560.81 Cambodia GFDL379 2030 4,387.49 Cambodia IPSL379 2030 4,391.17 Cambodia MPI379 2030 4,387.29 Cambodia MRI379 2030 4,389.80 Cambodia REFar6_NoCC 2030 4,383.41 Bangladesh GFDL379 2050 17,152.99 Bangladesh IPSL379 2050 17,239.88 Bangladesh MPI379 2050 17,183.69 Bangladesh MRI379 2050 17,139.80 Bangladesh REFar6_NoCC 2050 17,144.19 Cambodia GFDL379 2050 4,543.16 Cambodia IPSL379 2050 4,549.64 Cambodia MPI379 2050 4,542.84 Cambodia MRI379 2050 4,551.33 Cambodia REFar6_NoCC 2050 4,535.17
For instance for Bangladesh in 2030 I need to calculate the % difference between GFDL and REF, IPSL and REF, MPI and REF, and MRI and REF.
Same for 2050, and then the same for Cambodia in 2030 and 2050.
Any advice or suggestion is very welcome.
thanks
Nicola
Comment