I use a rclass program to obtain significance stars after running two regressions. When I run the first everything works great. When I run the second regression I get an error message ".1400877638392261' invalid name". Does it depend on the p-value that I get? The p-value from first regression is .03946642. Here is the code:

Code:
capture program drop make_stars
program define make_stars, rclass
if `1'<=0.01 {
    local star "***"
}
else if `1'<=0.05 {
    local star "**"
}
else if `1''<=0.1 {
    local star "*"
}
else {
    local star " "
}
return local star `star'
end

foreach dv in var1 var2 {

reg `dv' D

local d_`dv'=e(df_r)
local p_`dv'=2*ttail(`d`dv'',abs(_b[D]/_se[D]))

make_stars `p_`dv''
local star_m`dv' `r(star)'
}