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
Variables chosen for multiple imputationDear Statalist, I have a question regarding to choosing variables for multiple imputation. For exam…
Generating new variable based on ICD9 code range anywhere in the rowGreetings, A sample data set for my problem is shown below. I am trying to generate few new variabl…
icalc, intspec - "invalid 'focal' " errorHi, I'm trying to learn how to use Kaufman's* 'icalc' suite of commands to probe interactions and I…
Categorizing ICD-10 codes into major categoriesHi; I work with ICD-10 codes regularly. I'm currently involved in a project where several thousand …
Simple addplot syntax - how do I graph 2 sets of observations on one graph?Hi, Sorry to be that guy, but I can't find any stata help files or forum posts to clear this up. If…
Subscribe to:
Post Comments (Atom)
0 Response to failure to run program
Post a Comment