What is equivalent to the R command in Stata?

I am an enthusiast of R fighting for the land of Stat. I encountered the following problem in my attempts to "translate" from R to Stata:

In R, so that my script files do not get too big and crazy, I like to write them in smaller parts, and then have one main R script that is read in smaller ones, for example.

  • source("script-1.R")
  • code blah1
  • code blah2
  • source("script-2.R") etc.

I would like to do the same in Stata and tried to do

  • 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.dofor example. local bird 1 An object / macro bird is not available in the main script or available for script-2.do. If I try to display the content birdin the main script, it is just empty.

Why is this? Any tips?

+3
source share
2

include. include do ( run):

.

+6

Stata : local global. local , ( , do program). - script-1.do, , return, . (Do , program, rclass , program .) global , , .

R , Stata . - Stata, . , , Stata - , , R . , , .

, include . "" . , , , scalar, .

+6
source

All Articles