Search code examples
loopsstataturing-complete

Is Stata Turing-complete?


I have been doing some statistics work with Stata recently and not enjoying it very much.

It doesn't feel to me like it's a "proper" programming language: in particular I don't think there's a way to loop until a condition is met.

Am I right in my feeling, or is Stata truly Turing-complete?


Solution

  • I've never heard of Stata before but the webpage brags that it has "if, while" and "looping and branching".

    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
    

    I don't know what "proper" programming language means but at first glance it definitely appears to be Turing-complete.