I would like to generate a function that returns the degree of statistical significance with asterisks. The input of the function is p-value, scalar.
I would like to get * and *** when the input is 0.07 and 0.001, respectively.
My ultimate goal is to save the outcome of the program along with coefficients using postfile.
I'm new to stata, so any help would be appreciated.
Code:
program drop _all program ptosig, rclass args p if `p'<=0.01 scalar s="***" else if `p'<=0.05 scalar s="**" else if `p'<=0.10 scalar s="*" else scalar s="." return scalar s= s end
Code:
ptosig 0.07 ptosig 0.001
I'm new to stata, so any help would be appreciated.
Comment