Announcement

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

  • r(198) invalid variable name

    I keep having the same error
    'seriescode3.73536328367297 invalid variable name
    r(198); '
    I tried different ways, but I still can't fix it. Could someone give some advise?

    Code:
    reshape long YR, i(countryname seriescode) j(year)
    drop seriesname
    drop countrycode
    
    reshape wide seriescode, i(countryname year) j(YR)
    Last edited by ebe dutch; 18 Mar 2024, 11:32.

  • #2
    Should be the last line... My guess is your YR variable is not a suitable "j()" index.

    When it try to reshape to wide, it'd create multiple variables starting with seriescode~ that are followed by the values in each of YR. One of your YR values is "3.73536328367297", yielding a variable name of "seriescode3.73536328367297", which contains a period and thus not acceptable in Stata. That's why you got that error.

    No advice for now given the lack of clarity in the data and end-goal. But my first impression is that if your j() index is a long numerical continuous variable, then this approach is likely wrong.
    Last edited by Ken Chui; 18 Mar 2024, 11:19.

    Comment

    Working...
    X