My raw data has four variables (Item number, Grouping, Part code, Quote).
Item number | Grouping | Part code | Quote |
3328 | Group A | A | |
3328 | Group B | A | |
3328 | Group C | A | |
3328 | Group D | A | |
3328 | Group E | A | |
3328 | Group F | A | 2197.98 |
3328 | Group G | A | |
3328 | Group H | A | |
3328 | Group A | B | |
3328 | Group B | B | |
3328 | Group C | B | |
3328 | Group D | B | 1446 |
3328 | Group E | B | 1540.59 |
3328 | Group F | B | 1318.89 |
3328 | Group G | B | 1432.21 |
3328 | Group H | B | 1501.54 |
3328 | Group A | C | |
3328 | Group B | C | |
3328 | Group C | C | |
3328 | Group D | C | |
3328 | Group E | C | |
3328 | Group F | C | 1729.77 |
3328 | Group G | C | |
3328 | Group H | C | |
3328 | Group A | D | |
3328 | Group B | D | |
3328 | Group C | D | |
3328 | Group D | D | 1966 |
3328 | Group E | D | 1976.61 |
3328 | Group F | D | 1787 |
3328 | Group G | D | 1989.17 |
3328 | Group H | D | |
I used a proc tabulate statement to display the quote data, by part code, for each combination of item number and grouping.
From here, I need to calculate some new variables. I need a new part code that is derived by subtracting part code B from part code D, for all item number and grouping combinations. Can I calculate new variables within proc tabulate?
I'd be fine with calculating the data directly from the raw data, but I don't know how to tell SAS "subtract quote value for Part code D, item number 3328, group C from part code B, item number 3328, group C".
Any advice would be greatly appreciated.