Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • "invalid name" when presenting p<0.001 instead of p=0.000

    Dear All,
    I calculated p-value after using sts test, and I intended to acquire p<0.001 when calculated p-value is 0.000 (code as follows) (Stata version 16.0) But it returns "<0.001 invalid name". Could you please give me some advice? Thank you.

    Code:
    sts test x
    local logrankp: display %4.3f chi2tail(r(df), r(chi2))
    if `logrankp'==0 {
    local logrankp: display %9s "<0.001" 
    }

  • #2
    If you are displaying contents of the macro, you need to enclose it with double quotes.

    Code:
    di "`logrankp'"

    Comment


    • #3
      It works!!! Thank you, Andrew.

      Comment

      Working...
      X