Announcement

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

  • Jim Callegari
    replied
    Thanks for the response Andrew--that's really helpful. I wanted to know if there is a way for me to also stipulate "if" for the "xtline" command. I see in the help section I am allowed to, but it seems like the collapse command limits what I want to do with the "if" command. I want to make separate graphs for
    Code:
    if country=="UK"
    if country=="Ireland"
    Do you have any idea how I can utilize the collapse command while still maintaining that ability? Thanks so much!

    Leave a comment:


  • Andrew Musau
    replied
    No beverages in your example, but the following is illustrative:

    Code:
    gen newprod= cond(inlist(prod, "Apples (1 kg)", "Bananas (1 kg)"), "Fruits", "Others ")
    encode newprod, gen(product)
    preserve
    collapse abs_price, by(product year)
    xtset product year
    xtline abs_price, overlay scheme(s1color) ytitle("Price") xtitle("")
    restore
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	19.1 KB
ID:	1592234

    Last edited by Andrew Musau; 31 Jan 2021, 14:40.

    Leave a comment:

Working...
X