My working software stack is some combination of Stata and Python. I'm in a situation where it would be convenient to write an ado file - spent a day trying to get ChatGPT to help and that was a waste of time. At least it's patient. I am starting from scratch with the code below to just get an idea of how things work.
program define regress_R2
args x y
local n = _N
local offset = 10
forval i = `offset'/(`n' - `offset' + 1) {
display `i'
}
end
When I run this code I get:
- args x y
- local n = _N
- local offset = 10
- forval i = `offset'/(`n' - `offset' + 1) {
= forval i = 10/(7954 - 10 + 1) {
invalid syntax
Any help would be appreciated. I'm using trace and display to help debug - any better approaches?
program define regress_R2
args x y
local n = _N
local offset = 10
forval i = `offset'/(`n' - `offset' + 1) {
display `i'
}
end
When I run this code I get:
- args x y
- local n = _N
- local offset = 10
- forval i = `offset'/(`n' - `offset' + 1) {
= forval i = 10/(7954 - 10 + 1) {
invalid syntax
Any help would be appreciated. I'm using trace and display to help debug - any better approaches?
Comment