Hi Stata users,
I have a continuous variable and would like to generate a new variable that states which group the value belongs. So if a value lies between 0 and the first percentile, group is 1. If a value lies between the first and second percentiles, group is 2. So on until 100.
Below is a code with dummy data
Thanks in advance!
I have a continuous variable and would like to generate a new variable that states which group the value belongs. So if a value lies between 0 and the first percentile, group is 1. If a value lies between the first and second percentiles, group is 2. So on until 100.
Below is a code with dummy data
Code:
clear set obs 100000 gen food_expenditure=runiform()*1000
Comment