Hi,
I currently have data in this format showing the timing of bets over the day (HH= hour of the day using 24 hour clock, and the number represents the bet i.e. bet1 bet2 bet3...):
How would I reshape this into long format so that I have one HH variable repeated for each bet for each individual:
I have looked at the reshape command:
reshape long HH1 HH2 HH3 HH4 HH5 HH6 HH7 HH8 HH9 HH10 HH11 HH12 HH13 HH14 HH15 HH16 HH17 HH18 HH19 HH20, i(ID) j(n)
I am unsure which variables to put in i/j and keep getting errors such as this:
variable ID already exists
Data are already long.
variable HH1 already defined
Any help would be appreciated - very lost!
I currently have data in this format showing the timing of bets over the day (HH= hour of the day using 24 hour clock, and the number represents the bet i.e. bet1 bet2 bet3...):
ID | HH1 | HH2 | HH3 | HH4 | HH5 | HH6 | HH7 | HH8 |
1 | 10 | 12 | 15 | 15 | . | . | . | . |
2 | 9 | 12 | 13 | 19 | 21 | . | . | . |
3 | 15 | 18 | 19 | 19 | 22 | 23 | . | . |
ID | HH |
1 | 10 |
1 | 12 |
1 | 15 |
1 | 15 |
2 | 9 |
2 | 12 |
2 | 13 |
2 | 19 |
2 | 21 |
3 | 15 |
3 | 18 |
3 | 19 |
3 | 19 |
3 | 22 |
3 | 23 |
reshape long HH1 HH2 HH3 HH4 HH5 HH6 HH7 HH8 HH9 HH10 HH11 HH12 HH13 HH14 HH15 HH16 HH17 HH18 HH19 HH20, i(ID) j(n)
I am unsure which variables to put in i/j and keep getting errors such as this:
variable ID already exists
Data are already long.
variable HH1 already defined
Any help would be appreciated - very lost!
Comment