I am an R enthusiast struggling the land of Stata. I have encountered the following problem in my attempts to "translate" from R to Stata:
In R, so that my script files don't get too big and crazy I like to write them in smaller parts and then have one main R script that reads in the smaller ones e.g.
source("script-1.R")
- code blah1
- code blah2
source("script-2.R")
etc......
I would like to do the same thing in Stata and have tried doing
do "script-1.do"
- code blah1
- code blah2
do "script-2.do"
etc......
However, I find that if I create a macro in script-1.do
e.g. local bird 1
The object/macro bird is not accessible in the main script or accessible to script-2.do
. If I try to display the contents of bird
in the main script, it's just empty.
Why is this? Any advice?