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
Covariances across groups and quarters Code: * Example generated by -dataex-. To install: ssc install dataex clear input byte qrtr float(…
zoib regressionHi everyone, I have used the zero-one inflated beta regression but I have concerns. My dependent var…
metaprop - show subgroup pooled estimates onlyI using metaprop on 160 studies, subgrouping data by country. I want to suppress the study-level est…
labels of yDear All, I have this dataset Code: * Example generated by -dataex-. To install: ssc install dataex…
svyset: missing standard error because of stratum with single sampling unitSince the dataset I'm using has a Stratum (v022) with only one PSU (v021), and I have to use the fol…
Subscribe to:
Post Comments (Atom)
0 Response to failure to run program
Post a Comment