Announcement

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

  • "factor-variable and time-series operators not allowed" error after reshape

    I reshaped some data from wide to long to make it easier to summarize (easier to conditionally count observations than to conditionally count variables within rows). The values in the original wide variables and in the new long variable are strings. When I try to do just about anything with the column created by reshaping, I get the error "factor-variable and time-series operators not allowed". This happened when I tried to reorder the variable with -order reshaped_var after(other_var)- and now I am getting it when I try to use -contract-, specifically -contract reshaped_var other_var freq(n) percent(perc)-.

    The variable type/format is string (and all the variable values are strings) so I'm not sure why I am getting this error. It seems like maybe the variable is actually some sort of var list/factor variable as a result of reshape, but I'm not sure if that's accurate. How can I get this reshaped string variable into a format where I can actually manipulate the variable as I need to?

  • #2
    It's important for us to know what do the involved variables look like in terms of their format in Stata and the exact commands that you used. Without that it's unlikely to get helpful answers. Check out the FAQ (http://www.statalist.org/forums/help) and follow the details in section 12. Particularly about using of dataex.

    Comment


    • #3
      It looks as if you are omitting the comma that must precede any call to options.

      Comment


      • #4
        Nick Cox Thank you for pointing that out. Everything working as expected now.

        Comment

        Working...
        X