Dear All,
I am writing a simple Stata program that has a few arguments. But the arguments requires different kinds of inputs.
I am writing to see how I can prevent people entering the wrong format.
My program looks like this:
in the program, I hope that:
- alpha can be real and between 0 and 1 (open interval).
- beta is real and larger than 0
- sample size is a positive integer
How can I write the -if- condition to make sure that the program stops and user will receive an error message?
I tried to use the command -confirm-, but I am really confused because error message always shows up...
Thank you very much! I look forward to hearing from you!
Best regards
Long
I am writing a simple Stata program that has a few arguments. But the arguments requires different kinds of inputs.
I am writing to see how I can prevent people entering the wrong format.
My program looks like this:
:
capture drop myprogram program define myprogram args alpha beta samplesize
- alpha can be real and between 0 and 1 (open interval).
- beta is real and larger than 0
- sample size is a positive integer
How can I write the -if- condition to make sure that the program stops and user will receive an error message?
I tried to use the command -confirm-, but I am really confused because error message always shows up...
Thank you very much! I look forward to hearing from you!
Best regards
Long