Announcement

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

  • sepscatter, skip missing dates

    Hey All,

    I am using sepscatter (and recasting as a line) to graph monthly profits by store location. I have one month that is completely missing from the data (lets say its September). How do I just move from August to October on the graph?

    the option "missing" seems to want to add missing dates in, not skip them. Also, cmissing() is not allowed in this function.


    example code:
    sepscatter profit monthly if inlist(salesloc, 231, 232, 235, 236, 237, 249), sep(salesloc) recast(line) lc(blue orange black red green purple grey)



    How do I fix this issue?

    -Josh

  • #2
    sepscatter is from SSC, as you are asked to explain (FAQ Advice #12). The axes in scatterplots are continuous, so there is no notion of skipping values within an interval. You can drop the missing month then use the -group()- function of egen to create a new time variable where you identify the time periods using value labels.

    Code:
    help egen
    help label

    Comment


    • #3
      As Andrew Musau points out sepscatter is a command (not function) from SSC.

      The problem is not that cmissing(n) is not allowed, because it is, but that it has nothing to do because like many commands sepscatter ignores observations with missing values automatically, so cmissing() can see nothing to ignore.

      You could clone the program, which is not very long, so that it does what you prefer. Another solution which may or may not appeal is to recast(connect) which will make explicit which points are data points.

      Specifically,

      1. Copy the code to a new file. Change the program name to sepscatterjs and the name of the file to sepscatterjs.ado

      2. Change the marksample touse line to marksample touse, novarlist.

      3. Now a call to your program will respect something like cmissing(n n n n n n) as an option

      Last edited by Nick Cox; 09 Dec 2021, 19:26.

      Comment

      Working...
      X