Code:
 +-----------------------------+
  |      date   year   usd_to~r |
  |-----------------------------|
  | 01jan2011   2011     .64725 |
  | 01feb2011   2011     .63645 |
  | 01mar2011   2011     .63555 |
  | 01apr2011   2011       .633 |
  | 01may2011   2011     .61555 |
  +-----------------------------+
# I would like to generate a new variable usd_to_sdr_pch, which would contain the percentage change in usd_to_sdr in each month.

# Then, for the newly generated variable, I would like to find correlation between last three years( last 36 months) and the previous last three years( previous 36 months).

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(date year) double usd_to_sdr
18628 2011 .64725
18659 2011 .63645
18687 2011 .63555
18718 2011   .633
18748 2011 .61555
18779 2011 .62425
18809 2011 .62485
18840 2011 .62535
18871 2011 .62525
18901 2011 .64465
18932 2011 .63695
18962 2011  .6412
18993 2012 .64985
19024 2012 .64385
19053 2012 .64495
19084 2012 .64605
19114 2012   .645
19145 2012  .6631
19175 2012 .65835
19206 2012  .6632
19237 2012 .65645
19267 2012 .64925
19298 2012 .65045
19328 2012 .64995
19359 2013 .65015
19390 2013 .64735
19418 2013  .6643
19449 2013 .66565
19479 2013 .66005
19510 2013 .66555
19540 2013 .66595
19571 2013 .66225
19602 2013 .66115
19632 2013 .65135
19663 2013 .65375
19693 2013 .65245
19724 2014 .64855
19755 2014 .65245
19783 2014 .64625
19814 2014 .64725
19844 2014 .64415
19875 2014 .64935
19905 2014 .64595
19936 2014  .6523
19967 2014 .65955
19997 2014 .67425
20028 2014 .67965
20058 2014 .68285
20089 2015 .69165
20120 2015 .70925
20148 2015 .71185
20179 2015  .7243
20209 2015 .71225
20240 2015 .72095
20270 2015  .7135
20301 2015  .7168
20332 2015 .71055
20362 2015 .71265
20393 2015 .71515
20423 2015 .72765
20454 2016  .7227
20485 2016 .72445
20514 2016 .72445
20545 2016 .71175
20575 2016 .70255
20606 2016 .71275
20636 2016 .71635
20667 2016 .71565
20698 2016 .71515
20728 2016 .71625
20759 2016 .72535
20789 2016 .73905
20820 2017 .74365
20851 2017 .73475
20879 2017 .74125
20910 2017 .73695
20940 2017 .72995
20971 2017 .72195
21001 2017 .72045
21032 2017 .70805
21063 2017   .706
21093 2017 .70995
21124 2017 .71225
21154 2017 .70585
21185 2018 .70175
21216 2018  .6861
21244 2018 .69325
21275 2018 .68795
21305 2018 .69835
21336 2018 .70655
21366 2018 .71235
21397 2018 .71335
21428 2018 .71485
21458 2018 .71695
21489 2018 .72095
21519 2018 .72285
21550 2019 .71915
21581 2019  .7153
21609 2019   .717
21640 2019  .7205
end
format %td date