Hi,

I am trying to calculate a currency value factor based on currency spot and lagged exchange rates as well as inflation. I have multiple pairs of currencies s_X_Y and I do not know how to articulate the loop for my calculation.

Say we have 2 currencies A and B. I have also have their corresponding inflation and spot exchange rate, inf_* and s_*, respectively. I would like to generate the following factor:
VAL_A_B = ( L60.s_A_B / s_A_B )*(( 1+inf_A )/( 1+inf_B ))

I have many currency pairs s_X_Y as well as their corresponding inflation. The dataset is dynamic and will include more currency pairs in the future. I would like to take that into account when I create the loop. Here is a subset of my dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float date double(s_AUD_EUR s_AUD_GBP s_JPY_AUD) float(inf_AUD inf_EUR inf_GBP inf_JPY)
564 1.67755   2.527   93.71 .12673548   .0844182  -.01139772  -.017964073
565 1.67645 2.48715   93.45 .12547672  .08589864   .12435567        -.018
566  1.6478 2.42785   95.45 .12564413  .08708829    .1822086  -.018924303
567 1.63965 2.40265    99.4 .12579681  .08946155    .2832618  -.017910447
568 1.62585 2.39005  100.82 .12596282   .0883762    .5191083  -.017892644
569 1.59185 2.36485  104.77 .12612814  .08756845   .54937303  -.017910447
570 1.59765 2.37165  102.01  .1262788  .08427882   .14635761  -.015968064
571  1.6757 2.47935   94.67 .12644275  .08491046    .3345979   -.01497006
572 1.60705 2.30225  101.78 .12834732  .08591422    .1804878  -.015936255
573  1.5611 2.24155 106.855 .13025774  .08702653  -.03975155  -.012974052
574 1.65975  2.3249  98.065  .1321494  .08681957   -.1192429  -.012974052
575 1.66515 2.26705  98.075 .13301904  .08613088   -.2030981  -.011976048
576  1.6591  2.2277  94.875  .1338974  .08310215  -.12159468 -.0090452265
577 1.62295 2.12655   97.38 .13477059   .0849185  -.25827813 -.0090543255
578 1.73585 2.17725  90.855 .13740282  .08879744  -.21276596  -.008024072
579 1.65215  2.1017   98.48 .14004995  .08619346 -.024932615  -.007007007
580  1.6299 2.07265 100.625 .14267223  .08773803    .2118577  -.005994006
581  1.6418  2.0738 101.705 .14446443   .0877774   .58171207        -.004
582  1.6589  2.1061 101.635 .14623539  .08526683     .488959        -.004
583 1.70955  2.1179   93.47 .14801279   .0873821    .6260097  -.002997003
584 1.78075  2.2597  83.815 .14824998   .0872149    .7533281  -.000999001
585 1.92205   2.449  64.895 .14847282   .0891559     .627907  -.000998004
586  1.9486 2.35635  62.025 .14870887  .08935544    .8465116            0
587 1.99375  2.0622  63.135 .14804496    .089092    .2174393  -.001998002
588 2.01525  2.2672  57.095 .14738324    .082029   .04928989 -.0010060362
589   1.988 2.23115  62.495 .14673564   .0833775    .4528302  -.003018109
590  1.9109 2.06295   68.64  .1473157  .08561978     .710041  -.002008032
591  1.8036  2.0169  72.275 .14789385  .08542252    .6236897  -.004008016
592 1.76835 2.01455   76.37 .14847012   .0846458    .4918626  -.004008016
593   1.735 2.03705   78.02  .1507409  .08242555   .24603175  -.006012024
594  1.7054  1.9942   79.13 .15299253  .07929843    .5317869  -.006024096
595  1.7022  1.9332   78.21  .1552641  .08061841    .6756505  -.007021063
596  1.6562  1.8122   79.04 .15493555  .08032352    .9813084  -.007014028
597 1.63285  1.8242   81.78  .1546337  .08164706   1.0903955  -.008016032
598  1.6402  1.7929   78.86  .1543078   .0802193    .8110161   -.00603015
599  1.5953  1.7956   83.76   .153884  .08031642   1.1674312  -.009036144
600  1.5638 1.80275   80.58  .1534374  .07345896   1.4972023  -.008072654
601 1.52395  1.7001   79.61  .1530068  .07571717   1.4712447  -.007077856
602  1.4742 1.65265   85.79 .15403315  .08061742   1.1537906  -.008064516
603 1.42845 1.64435   87.49  .1550436  .07957082   1.1556802  -.012072435
604 1.46295  1.7323   76.37 .15606508   .0776344    .9267015  -.015075377
605  1.4502 1.77125   74.75  .1577442  .07810366   1.0198413   -.01510574
606 1.43915    1.73   78.48    .15943  .07563687     .441353   -.01715439
607 1.42795 1.72675    74.8 .16109574  .07721397    .5493586  -.016145308
608 1.40995 1.62745   80.83 .15925056  .07882747   .58651024  -.018126888
609   1.418  1.6311   78.94 .15741123  .07883093    .6142433   -.01510574
610  1.3573 1.62385   80.32   .155591  .07744375    .7764096  -.014141414
611 1.30875  1.5274   83.11 .15640174   .0769846    1.168919  -.016145308
612  1.3751 1.60655   81.67 .15722005  .07153713    1.401269  -.014213198
613 1.35635  1.5973   83.41  .1580231  .07260431   1.3500698  -.013224822
614 1.37225    1.55   85.69 .15765116   .0803583   1.4501534  -.014198783
615  1.3557 1.52415   88.85 .15728094  .08053413   1.8968503  -.015182186
616  1.3492  1.5447   86.55 .15691246  .07884407   2.0982392  -.015166835
617  1.3542  1.4996   86.46  .1569296  .07888823   1.3087137  -.018200202
618  1.3082  1.4944   84.79  .1569467   .0729896    2.525196  -.018218623
619  1.3444  1.5204    81.9  .1569749  .07526676   1.9470198  -.017206477
620  1.3805 1.60285   74.87 .15589806   .0801351    1.438738   -.01919192
621  1.3147 1.52135   82.71  .1548236  .07954833    1.341719   -.01919192
622  1.3104   1.531   79.79 .15375504   .0781817    .9846532   -.02123357
623  1.2662  1.5159   78.87  .1530809   .0778164     .672058   -.02224469
624 1.23175  1.4849   81.02 .15239653  .06942296    .5995145  -.019308943
625  1.2381  1.4785    87.5  .1517276 .068929486    .3971347   -.01527495
626  1.2855  1.5423   85.27 .15061463  .07755432   .27919045  -.016243655
627 1.27135  1.5598   83.12 .14950676  .07692388   .17056856  -.017223911
628 1.27475 1.58685   76.09 .14840397  .07491467    .1629979   -.01923077
629 1.23805  1.5301    81.8 .15071887  .07532665   .08042488  -.019250253
630  1.1703 1.48885   82.16  .1530342  .07096087    .3292894  -.020283977
631  1.2197 1.53695   80.92  .1553281  .07108076   .17282547  -.020263424
632 1.23715 1.55285   80.89 .15254144    .076373    .4566116   -.02125506
633  1.2496 1.55365   82.91 .14977197  .07522193    .7011643   -.02224469
634  1.2467  1.5362   86.03 .14702277  .07275268    .8853868   -.02527806
635  1.2699  1.5657   89.77 .14423741  .07329411    .6969042   -.02828283
636  1.3014    1.52   95.17 .14147276  .06490843    .7034796  -.027383367
637 1.27705  1.4827   94.49 .13872857  .06364183    .8449675   -.02639594
638  1.2317  1.4565   98.03 .13591652 .071766794   1.0033784  -.027300304
639  1.2701 1.49935   101.1 .13311712  .06944986    .3510712   -.02721774
640 1.35175 1.58135    96.8 .13034226  .06883999    .4624918   -.02914573
641 1.42005 1.65695   90.92 .13022657  .06823104    .4323493    -.0311245
642  1.4796 1.68925   88.26 .13012223  .06398308    .0746822    -.0311245
643  1.4805  1.7368    87.4 .13000816  .06235679 -.003974168   -.03206413
644 1.44765  1.7319   91.76 .13054208  .06681828  -.02992407        -.033
645 1.43565  1.6966    92.9 .13107444  .06321681  -.09100529   -.03196803
646  1.4899 1.79245   93.54 .13160528  .06243844  -.10125945        -.031
647  1.5402  1.8513   94.02 .13218278  .06089287    .5339982   -.03003003
648  1.5456  1.8836   88.98 .13276942  .05626357    .2794586  -.027190333
649 1.54345  1.8728   91.34 .13333264  .05609192   .04081633   -.02421796
650   1.487 1.79875   95.45 .13339901  .06374559   -.0401438   -.02414487
651  1.4965  1.8224   94.64 .13347545  .06130384    .2846998  -.003018109
652 1.46615 1.80225    94.7 .13354124  .05957224  -.03878788 -.0020120724
653  1.4506 1.81155    95.6 .13134463  .06141075    .2878981 -.0010080645
654  1.4392   1.816   95.57 .12916201  .05853866   .00224341   .002020202
655  1.4083 1.77565   97.15 .12698169   .0583383   .05601775   .003030303
656 1.44365  1.8526   95.99 .12711605  .06205854  -.09846698  .0020181634
657 1.42535  1.8201   98.55 .12723844  .05844312   -.1772973   .005050505
658 1.46065 1.83485  101.31 .12737188   .0586036  -.34556895   .005055612
659 1.47865 1.90535    98.1  .1270489   .0573695  -.55132276   .007092198
660 1.44905  1.9286   91.53 .12674901  .05474968   -.5393726   .009155646
661 1.43295 1.97435   93.58  .1264405  .05558142  -.57276833     .0101833
662 1.40585 1.94315   91.63 .12548126  .05878761    -.650352    .01117886
663 1.42065  1.9483   94.31 .12452602  .06215914    -.741054   .017311608
end
format %tm date
This is what I am trying to get for each pair:
Code:
gen VAL_AUD_EUR = (L60.s_AUD_EUR/s_AUD_EUR)*((1+inf_AUD)/(1+inf_EUR))
How can I create a loop that goes over every single spot exchange rate s_X_Y? Thanks a lot in advance.