Is Stata Turing-complete?

I recently worked on statistics with Stata and did not really enjoy it. It does not seem to me that this is the “correct” programming language: in particular, I don’t think that there is a way to loop until the condition is met. Am I right in my feeling, or is Stata really Turing - complete?

+5
source share
4 answers

I had not heard about Stata before, but the web page boasts what it has if, for now , and loop and forks .

Wikibooks has this example :

local k = 1
file open myfile using toto.txt, read text
file read myfile line
while r(eof) == 0 {
    local k = `k' + 1
    di "`k' `line'"
    file read myfile line
    }
file close myfile

, "" , , , .

+2

"" , - ? . . .ado .do; , .

+1

-while-, -if, -else , , Stata -foreach -forvalues-loops .
, , :

while "`1'" != "" {
<do something>
} 

if "`a'" == "" {
<do something>
}
else {
<do something else>
}

( ) :

forvalues x = 1/100 {
<do something>
}

- -f-, -sese- -break-. . -help forvalues- -help foreach- Stata.


^ : while-else - -, . -sese-part if {] else {}. , , while/else if/else, , , -foreach -/- forvalues.

0

@eric.a.booth: , . , - while { ... } else {...}

, Stata , .

local x = 0
while `x'<5 {
   display `x' / 2
   local ++x
}
0

All Articles