Announcement

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

  • Trouble twoway / cmissing command

    Hello,

    I am experiencing some troubles to use cmissing command with twoway graph.
    I have a basic twoway line code as follow :

    twoway (line asylapp year if resi == "Italy", cmissing(n)) ///
    (line asylapp year if resi == "United Kingdom", lpattern(dash)), ///
    note(Note : data are not available for Italy from 2000 to 2004)

    I have Panel data from 1990 to 2013 and no data for Italy between 2000 and 2004

    When I run the do-file, the line still appears between this period. I tried to change
    the command by using twoway connected or scatter but it didn't work. I also tried
    to use the command sort before cmissing but it ditn't improve my result.

    Is there another solution than using the xtline command by going with panelvar?

    Thanks,
    Lucas Guichard

    Note : I am working on Stata 13.1 MP






  • #2
    Are the observations for asylapp missing or are there simply no observations between years 2000 and 2004. Perhaps you need to tsfill before running twoway line

    Compare the difference between these examples:
    Code:
    webuse grunfeld,clear
    drop if inrange(year, 1940, 1950)
    twoway line invest year if com == 1, cmissing(n)
    tsfill
    twoway line invest year if com == 1, cmissing(n)
    webuse grunfeld,clear
    replace invest = .  if inrange(year, 1940, 1950)
    twoway line invest year if com == 1, cmissing(n)

    Comment


    • #3
      Thanks for your answer Scott!
      I will try that, there are no observations between those years for Italy

      Comment


      • #4
        Solved, Sorry!

        Comment


        • #5
          Thanks for #2 Scott Merryman - I found it very useful also to solve a similar issue.
          Stata BE ver 17
          MacOS Ventura

          Comment

          Working...
          X