I want to have a code that I can reuse to create "significant-asteriks" next to regression-coefficents in tables.
This attempt works:
Code: Select all
subroutine signif(string %eq, scalar !coef)
!sig10 = 0
!sig5 = 0
!sig1 = 0
if {%eq}.@pval(!coef) < 0.01 then
!sig1=1
endif
if {%eq}.@pval(!coef) < 0.05 then
!sig5=1
endif
if {%eq}.@pval(!coef) < 0.1 then
!sig10=1
endif
%ast = ""
for %p 10 5 1
if !sig{%p} = 1 then
%ast = %ast + "*"
endif
next
endsub
' ..... lots of code, but not in subroutine
call signif("eq_of2",3+!case)
tab_reg(!r,7+!case) = @str(eq_of2.@coefs(3+!case),"f.4")+%ast
Code: Select all
' Program: Signif_asteriks.prg (in Addin-folder so Eviews finds it)
!sig10 = 0
!sig5 = 0
!sig1 = 0
!coef = @val(%1)
if {%0}.@pval(!coef) < 0.01 then
!sig1=1
endif
if {%0}.@pval(!coef) < 0.05 then
!sig5=1
endif
if {%0}.@pval(!coef) < 0.1 then
!sig10=1
endif
%ast = ""
for %p 10 5 1
if !sig{%p} = 1 then
%ast = %ast + "*"
endif
next
Code: Select all
' lots of code ....
exec signif_asteriks eq_of 4
tab_reg(!r,5) = @str(eq_of.@coefs(4),"f.4")+%ast
