Hi,

I have a large do file that I would like to break down in several smaller pieces of code that I could run (or not) from the top of the file. I do not want to break down the main .do file in several .do files but rather have more control over the part of the code I am running in 1 single do file.

* Main file:
** Call 1st piece of the code: 1) Merging data
***** Some code that calls the 1st part "merging data"

** Call 2nd piece of the code: 2) regression analysis
***** Some code that calls "regression analysis
etc.


I have tried the following but I get the error message below. Anyone can point to the right direction/format?Thanks!

Code:
clear
main

capture program drop main
program main
    test
end

capture program drop test
program test
    di "Hello World"
    test2
end

capture program drop test2
program test2

input x y
32 56
26 67
34 61
39 58
29 58
end

list
end
Code:
. clear

. main
command main is unrecognized
r(199);

end of do-file
Can someone tell me what I am doing wrong? Thanks

I have tried to post a similar message a few days ago:
https://www.statalist.org/forums/for...e-same-do-file