Announcement

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

  • Question about generating a small table, having issues with getting the categories set up as I want

    Good day, I would like to create a simple table (I use multiple imputations) with 2 variables

    I want the graph to compare past inheritances with the expectation of future inheritances

    I would like the data to be grouped as follows

    The value of past inheritances in Euros
    0, up to 10000, up to 100000, and over 100000

    Expectation of future inheritances is a binary variable where 1 = expects a future inheritance

    My code looks as follows

    Code:
        gen gift_class_nozero = 0 if gift_total < . 
    
        quietly foreach cut in 10000 100000 { 
            replace gift_class_nozero = `cut' if inrange(gift_total, `cut', .)  
        } 
        label define gift_class_nozero 0 "<10K" 10000 "<100K" 100000 "100K+    " ,replace
    
        label val gift_class_nozero gift_class_noerzo
    And then I use

    Code:
    mi xeq: tab expectation gift_class_nozero, cell
    However, the results are not exactly what I was hoping for.

    In the picture I attached you see that the categories are not named as I want and also there is no 100K+ category, to cover for inheritances larger than a certain amount. What did I do wrong?
    Attached Files

  • #2
    Have you confirmed that there are observations with more than 100 000 euros among the original data?

    I recommend using a different name for your set of value labels from the variable name, maybe switching the first letter to upper case.

    Comment

    Working...
    X