Announcement

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

  • String variable quarterly time

    Hello everyone,

    First of all, I have learned a lot from this forum. However, I could not find the answer to this specific questions:
    My data looks as follows:

    q1 frqcy time
    2002 1 2002q1
    2002.25 3 2002q2
    2002.5 4 2002q3
    2002.75 5 2002q4
    2003 8 2003q1

    When I try to make a scatterplot, It shows:

    . scatter frqcy time
    string variables not allowed in varlist;
    time is a string variable

    I have not been able to destring my variable time while I saw on different youtube videos that they also used year+quarter, e.g., 2002q1.
    I am sorry, I do not know to copy the Sata results properly.



  • #2
    Hi, you can generate a sample of your data with -dataex-.
    For problems with times and dates, help datetime is very helpful.
    Code:
    gen year_q = quarterly(time, "YQ")
    format year_q %tq
    scatter frqcy year_q

    Comment


    • #3
      Thanks Wouter!! I've tried finding it out for 2 hours.

      Comment

      Working...
      X