Hello,
I have the following dataset (table 1) that I am trying to pivot longer to make it look like table 2 below. However, when I run my code below it returns an error message. Could someone please help me with this? I tried using the documentation but I could not understand the syntax in there. Thanks!
Table 1:
Table 2:
I have the following dataset (table 1) that I am trying to pivot longer to make it look like table 2 below. However, when I run my code below it returns an error message. Could someone please help me with this? I tried using the documentation but I could not understand the syntax in there. Thanks!
Table 1:
club_id | club_name | ft_coaches | ft_scouts | ft_physiotherapists | ft_assistants |
"1056" | "Eagles FC" | 3 | 5 | 3 | 7 |
"1078" | "Bears FC" | 7 | 10 | 5 | 12 |
Table 2:
club_id | club_name | role | count |
"1056" | "Eagles FC" | ft_coaches | 3 |
"1056" | "Eagles FC" | ft_scouts | 5 |
"1056" | "Eagles FC" | ft_physiotherapists | 3 |
"1056" | "Eagles FC" | ft_assistants | 7 |
"1078" | "Bears FC" | ft_coaches | 7 |
"1078" | "Bears FC" | ft_scouts | 10 |
"1078" | "Bears FC" | ft_physiotherapists | 5 |
"1078" | "Bears FC" | ft_assitants | 12 |
Code:
reshape long ft_coaches ft_scouts ft_physiotherapists ft_assistants, i(club_name) j(role)
Comment