Announcement

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

  • Time series for categorical variable

    Hi everyone,

    I am trying to make a time series line plot for dummy variable car purchased called "car" where 1="honda" 2="toyota" 3="vw" 4"bmw". I want to chart the number of cars purchased between 2010 to 2020. Im struggling with the syntex considering its a categorical value

  • #2
    I wouldn't call a categorical variable with four distinct levels a dummy variable.

    There is no data example in #1. At a guess something like this could be close to what you want:

    Code:
    preserve
    
    contract car year
    separate _freq, by(car) veryshortlabel
    line _freq? year
    
    restore
    OR some variation on

    Code:
    tabplot car year 
    where tabplot is from the Stata Journal.
    Last edited by Nick Cox; 09 Oct 2023, 14:45.

    Comment


    • #3


      Good day,

      Thank you so much Nick. Worked like a charm

      Comment

      Working...
      X