I have several very long codes which I uses for different central bank analysis. As these codes are very similar, I would like to split the codes in different smaller programs using exec and use variables as placeholder whenever possible.
More precisely, suppose the first program is a master file where I define different parameters such as
Frist Program “Master file”
Code: Select all
'choose CB
%CB = "fed"
!model = 1
‘Only string objects are passed to other programs
string CB = %CB
exec .\List_of_variables.prg
scalar test1 = num_var_dep
scalar test2 = !num_var_inf
Code: Select all
if CB = "fed" then
'Create list of dependent variables
string list_var_dep = "A B C"
scalar num_var_dep = @wcount(list_var_dep)
'Create list of inflation
%list_var_inf = "X Y Z"
!num_var_inf = @wcount(%list_var_inf)
endifCode: Select all
if %CB = "fed" then Why is this the case and how can I pass variables between different programs?
Later I want to loop over the list of variables, so string objects would not work. I could probably redefined string objects to variables (%list_var_dep = list_var_dep), but I think this is not very handy as I am doing this for several input / output variables. Also, I assume it must somehow be possible to pass variables to other programs.
Thanks a lot for your help in advance!
Best,
Florian
