Hi all,
I have the following data set on courses and games being played in them:
sumspecific_course_X variables refer to the total number of users playing in each of the 5 courses of the data set while the users_playing_both variable refers to number of games that users have played in both course a and course b. coursea and courseb include all the possible unique pairs of courses. My goal is to use the sumspecific_course_X variables to create a data set that looks like this:
I would appreciate any advice on how to create a loop that achieves this since I am trying to run the code on a data set with more than 5 courses.
Thank you in advance.
I have the following data set on courses and games being played in them:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str1(courseida courseidb) float(users_playing_both sumspecific_course1 sumspecific_course2 sumspecific_course3 sumspecific_course4 sumspecific_course5) "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 "1" "2" 0 331 126 3535 3521 434 "1" "3" 0 331 126 3535 3521 434 "1" "4" 0 331 126 3535 3521 434 "1" "5" 2 331 126 3535 3521 434 "2" "3" 2 331 126 3535 3521 434 "2" "4" 2 331 126 3535 3521 434 "2" "5" 0 331 126 3535 3521 434 "3" "4" 30 331 126 3535 3521 434 "3" "5" 1 331 126 3535 3521 434 "4" "5" 0 331 126 3535 3521 434 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str1(courseida courseidb) float(users_playing_both users_playing_course_a users_playing_course_b sumspecific_course1 sumspecific_course2 sumspecific_course3 sumspecific_course4 sumspecific_course5) "1" "2" 0 331 126 331 126 3535 3521 434 "1" "3" 0 331 3535 331 126 3535 3521 434 "1" "4" 0 331 3521 331 126 3535 3521 434 "1" "5" 2 331 434 331 126 3535 3521 434 "2" "3" 2 126 3535 331 126 3535 3521 434 "2" "4" 2 126 3521 331 126 3535 3521 434 "2" "5" 0 126 434 331 126 3535 3521 434 "3" "4" 30 3535 3521 331 126 3535 3521 434 "3" "5" 1 3535 434 331 126 3535 3521 434 "4" "5" 0 3521 435 331 126 3535 3521 434 "1" "2" 0 331 126 331 126 3535 3521 434 "1" "3" 0 331 3535 331 126 3535 3521 434 "1" "4" 0 331 3521 331 126 3535 3521 434 "1" "5" 2 331 434 331 126 3535 3521 434 end
Thank you in advance.
Comment