Suppose that i have following data
ID Category Price Month
1 X 2 1
1 X 2 2
1 X 2 3
1 X 2 4
2 X 3 1
2 X 3 2
2 X 3 3
2 X 3 4
3 X 1 1
3 X 1 2
3 X 1 3
3 X 1 4
4 X 10 1
4 X 10 2
4 X 10 3
4 X 10 4
5 Y 5 1
5 Y 5 2
5 Y 5 3
5 Y 5 4
6 Y 2 1
6 Y 2 2
6 Y 2 3
6 Y 2 4
7 Y 1 1
7 Y 1 2
7 Y 1 3
7 Y 1 4
8 Y 10 1
8 Y 10 2
8 Y 10 3
8 Y 10 4
There are different prices for products in a particular category, some are low priced and some high priced. I want to have a new variable "Price Level" which shows whether the product is low priced product, medium priced product or high priced product.
Levels are defined as follows. It takes the prices of all the products in a particular category and divide into 4 percentiles.
- 1st Percentile = Low
- 2nd and 3rd percentile = Medium
- 4th percentile = High
So the table will look like this
ID Category Price Month Price Level
1 X 4 1 Medium
1 X 4 2 Medium
1 X 4 3 Medium
1 X 4 4 Medium
2 X 3 1 Medium
2 X 3 2 Medium
2 X 3 3 Medium
2 X 3 4 Medium
3 X 1 1 Low
3 X 1 2 Low
3 X 1 3 Low
3 X 1 4 Low
4 X 10 1 High
4 X 10 2 High
4 X 10 3 High
4 X 10 4 High
5 Y 5 1 Medium
5 Y 5 2 Medium
5 Y 5 3 Medium
5 Y 5 4 Medium
6 Y 2 1 Low
6 Y 2 2 Low
6 Y 2 3 Low
6 Y 2 4 Low
7 Y 1 1 Low
7 Y 1 2 Low
7 Y 1 3 Low
7 Y 1 4 Low
8 Y 10 1 Low
8 Y 10 2 Low
8 Y 10 3 Low
8 Y 10 4 Low