Robert Picard, thank you very much for this hint
and another question raised with regard to my merging process
I now would like to merge different datasets from 1962 - 1982 (year) without doing that manually
what I don't want to do:
use "year1962"
merge 1:1 id using "year 1963"
save "year62-63", replace
merge 1:1 id using "year 1964"
save "year62-63-64", replace
...
is there any possibility to do that automatically maybe by using a vector comprising the years from 1962-1982
to my mind foreach/forval is no solution here because it is only able to merge 1962 with 63, 64, 65 etc and not all years together
moreover I wonder whether there is an Option to set values to variables like forval/foreach does but for the whole dataset; meaning that if I write `x', Stata replaces it with a value I set before (at the beginning of the dataset)
there is for example the command local datapath "..." which fulfils exactly the function I desire but regrettably it only should be used in Terms of datapath and I used it already in my dofile
I'd appreciate if somebody can help me
and another question raised with regard to my merging process
I now would like to merge different datasets from 1962 - 1982 (year) without doing that manually
what I don't want to do:
use "year1962"
merge 1:1 id using "year 1963"
save "year62-63", replace
merge 1:1 id using "year 1964"
save "year62-63-64", replace
...
is there any possibility to do that automatically maybe by using a vector comprising the years from 1962-1982
to my mind foreach/forval is no solution here because it is only able to merge 1962 with 63, 64, 65 etc and not all years together
moreover I wonder whether there is an Option to set values to variables like forval/foreach does but for the whole dataset; meaning that if I write `x', Stata replaces it with a value I set before (at the beginning of the dataset)
there is for example the command local datapath "..." which fulfils exactly the function I desire but regrettably it only should be used in Terms of datapath and I used it already in my dofile
I'd appreciate if somebody can help me
Comment