I have the following code:
There are over 50 unique observations in the "type" variable and I'm hoping that someone can have a bit of code that will do this based on the observations as they may vary from month to month (some months there will be 40 and others 40 to 50).
proc summary data=work.old_data nway;
class suburb type;
var customers ;
output out=work.new_data sum= ;
run;
Mock Data | | | | | |
Suburb | Type | Customers | | |
Suburb1 | Type1 | 50 | | | |
Suburb1 | Type2 | 100 | | | |
Suburb1 | Type3 | 2 | | | |
Suburb1 | Type4 | 3000 | | | |
Suburb1 | Type5 | 250 | | | |
Suburb2 | Type1 | 25 | | | |
Suburb2 | Type2 | 35 | | | |
Suburb2 | Type3 | 7500 | | | |
Suburb2 | Type4 | 1 | | | |
Suburb2 | Type5 | 5 | | | |
| | | | | |
Desired Result | | | | | |
Suburb | Type1 | Type2 | Type3 | Type4 | Type5 |
Suburb1 | 50 | 100 | 2 | 3000 | 250 |
Suburb2 | 25 | 35 | 7500 | 1 | 5 |