Loop Programming and Estimation
Posted: Tue Jul 10, 2012 5:47 am
I've got a number of variables with similar names that I'd like estimate in a similar manner.
For each variable the naming memnomic take the form of: CA_12_POP where:
-"CA" is the country. In this case it's Canada, but I've also go US, UK, FR
-"12" is the province/state/region
-"Pop" indicates that this var is population, but there's others incl GDP, DPC, etc.
I've used simple loop programming before of the type (example below, not actual eqn)
My question is, how would I write the code/program to estimate the above example equation if I wanted to test it at the regional level? Would it take the form below or would I need to use a different form of programming?:
For each variable the naming memnomic take the form of: CA_12_POP where:
-"CA" is the country. In this case it's Canada, but I've also go US, UK, FR
-"12" is the province/state/region
-"Pop" indicates that this var is population, but there's others incl GDP, DPC, etc.
I've used simple loop programming before of the type (example below, not actual eqn)
Code: Select all
For %1 CA US UK
equation {%1}.ls GDP{%1} C POP{%1} ERATE
Next
Code: Select all
For %1 CA US UK %2 1 2 3 4 5
equation{%1}_{%2}.ls GDP{%1}_{%2} C POP{%1}_{%2} ERATE
Next