Announcement

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

  • how to separate the result by region

    I have a number of variables. the variables are insurance types, a region of address, and another 5 years age group.
    I want to generate a mean of the holder of specific insurance types detailed separated for each region then separated again for each age group.

    I have tried this:
    foreach var in Employer_Insurance Private_Insurance Other_Insurance {
    mean `var' [iw=weight_value/1000000]
    mean `var' [iw=weight_value/1000000], over(age_group)}

    But I don't know how to separate the result by region of address. please fix my codes.

    Thanks in advance for any help

    Henggar

  • #2
    separated for each region then separated again for each age group.
    You can specify a variable list within -over()-.

    Code:
    mean `var' [iw=weight_value/1000000], over(region age_group)
    Except that if your variable "region" is a string, you need to encode it first to include it.

    Code:
    encode region, gen(Region)
    mean `var' [iw=weight_value/1000000], over(Region age_group)

    Comment


    • #3
      thank you for your kind replied Andrew

      variable "region" is not a string variable.
      I have run your codes but I have found

      --------------------------------------------------------------
      | Mean Std. Err. [95% Conf. Interval]
      -------------+------------------------------------------------
      None | 59.68389 .5085219 58.68708 60.68071
      --------------------------------------------------------------
      estimates post: matrix has missing values
      r(504);

      end of do-file

      r(504);
      .
      Could you explain this one? Each region has variance with complete data for each group. for example, some regions have 0 holders of private insurance.
      Thanks in advance for more help

      Henggar

      Comment


      • #4
        Not with the information that you have provided. You need to present a sample of your data and codes that reproduces the error. Refer to FAQ Advice #12 on how to do this using dataex.

        Comment

        Working...
        X