Announcement

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

  • Multiply one variable with right variable from list of 5-6 variables when certain conditions meets.

    I am calculating the value of productions. There are 67 products list in variable 'product'. Respected unit of measurement of the product is given in variable 'unit'. Now there are 7-8 variables for price at different level of strata e.g. price at primary sample units 'p1', price at districts levels 'p2' , price at province level 'p3', price at national level 'p4', progressively higher levels of aggregation. However, there are missing values, more in small strata. So, what I need to do is to multiply respective product 'quantity' with small strata if price is not missing and move to progressively higher strata price if price is missing for smaller strata and get the value of product in one variable call it 'value'.
    Last edited by Ishwor Adhikari; 30 May 2018, 17:55.

  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    You can do a replace with an if condition based on the price not being missing and then another replace if at the next level.

    Comment

    Working...
    X