I have a dataset in STATA which looks as follows
I want to split the Region and Sales variables into separate rows (separation at ~). Each row will have a different number of regions and sales figures but for every row, a region will always correspond to a sales figure.
I want the final data to look like as below
I am new to using STATA so any help will be very useful.
ID | Product | Region | Sales |
001 | JSF045 | East~West~North | 45~78~14 |
002 | JSF056 | East~West | 56~35 |
003 | GWW1 | West~North~South~South East | 11~16~45~36 |
I want the final data to look like as below
ID | Product | Region | Sales |
001 | JSF045 | East | 45 |
001 | JSF045 | West | 78 |
001 | JSF045 | North | 14 |
002 | JSF056 | East | 56 |
002 | JSF056 | West | 35 |
Comment