Announcement

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

  • Panel / data management using Lags /xtset

    Good Morning everyone !!!

    I need to perform the following command:
    Code:
    xtset IDpanel Time
            by IDpanel: replace  Q49_14_TEXT  = Q49_14_TEXT[_n-1] if  Q49_14_TEXT  ==""
            by IDpanel: replace  Q49_14_TEXT  = Q49_14_TEXT[_n+1] if  Q49_14_TEXT == ""
    The fact is that until I work whit string variables it works, but when I try with numerical one it doesn't, I had also tried those syntax:
    Code:
    xtset IDpanel Time
            by IDpanel: replace  Q49_14  = Q49_14[_n-1] if  Q49_14  == .
            by IDpanel: replace  Q49_14  = Q49_14[_n+1] if  Q49_14== .
    -----------------------------------------------
    Code:
    xtset IDpanel Time
            by IDpanel: replace  Q49_14 = Q49_14_TEXT[_n-1] if  Q49_14 == "."
            by IDpanel: replace  Q49_14  = Q49_14_TEXT[_n+1] if  Q49_14== "."
    --------------------------------------------------------------------------

    Code:
    xtset IDpanel Time
            by IDpanel: replace  Q49_14 = Q49_14_TEXT[_n-1] if  Q49_14 ==
            by IDpanel: replace  Q49_14  = Q49_14_TEXT[_n+1] if  Q49_14==
    but Stata return to me that error "invalid syntax" or "type mismatch" or "weights not allowed"... Where I fail? Someone could kindly help me?
    Thank you so much in advance for your time !!
    Last edited by Chiara Tasselli; 22 Mar 2022, 04:54. Reason: xtest

  • #2
    Sorry solved ... I think I cannot delete it...

    Comment

    Working...
    X