Dear Stata Forum members,
I made a program like this:
cap program drop sampletps
program define sampletps
version 14.2
syntax [anything] , p(real .5) N(real) ntps(real) sigma(real .001) ci(real .95)
local z = invnormal((1-`ci')/2)
local sampledpt = (`p'*(1-`p'))/((`sigma'^2/`z'^2)+((`p'*(1-`p'))/`N'))
local dpttps = `N'/`ntps'
local sampletps = `sampledpt'/`dpttps'
di "Samples DPT needed = " `sampledpt'
di "Samples Polling Stations needed = " `sampletps'
end
* test
sampletps, p(.5) N(192000000) ntps(801838) sigma(.001) ci(.99)
however, when I test it, it failed. I got the message like this
invalid syntax
r(197);
can somebody help me what's wrong with this code? Thank you
Best regards,
Afri
Related Posts with failure to run program
How to ask stata to read from the specific row using the dictionaryHow to ask stata to read from the specific row using the dictionary, say like I want to skip first f…
Running Mixed Logit Models with > 20 Random CoefficientsHi there, I'm trying to run a Mixed Logit Model using the user written mixlogit command of the form…
Paired t-test across different countriesDear all I have a hierarchical mass opinion survey data, 83,961 individuals nested in 21 countries.…
Updated markstat for handling bibliographic citationsThanks to Kit Baum, markstat 2.6 is now available on SSC. To update type -ado update markstat, updat…
Help tracking down a possible bug under an older version of Stata: error 197, syntax statementHi all, This is a bit of an odd request, and it might end up going nowhere. I am the current maint…
Subscribe to:
Post Comments (Atom)
0 Response to failure to run program
Post a Comment