Hello everyone,
I am woking on residence data from a university. The full dataset include several residences with rooms and appartments for one to 4 students - a range of single rooms up to quadruple rooms or 4-bedroom appartments.I would want to generate a variabe which looks at the four variables and returns a match.
The four variables include the room number (rmno), the bed id (bed_app - denoting whether it's a double room with letters A and B or a single room with letter S), student id (id), and the id of the requested roommate(s) (req1 - a student can request up to 3 roommates, though I include in the below sample only the variable for the first requested roomate). The match I am looking for is the intersection between the two sets: set 1 of the room number (rmno) and student id (id), and set 2 of the room number and req1.
In the below sample, I looked at only one residence building, which offers either single or double rooms. This is a 10-storey building, of which a floor can consist of rooms numbered from 1 to 16 or 17 depending whether it is an odd or even floor, and rooms on the first three floors are usually limited, preserving the space for the administration. I sorted by the room number, and removed those who did not make a roommate request for the ease of data visualization.
As can be seen, some request were met, while some were not fulfiled by the administration. I am thinking of creating a perfect match (for a double room with two requests which were fulfilled), a partial match (for a triple or quadruple room with one or two fulfilled requests), and unfulfilled match, while keeping a full data set of those who did not make a roommate request.
id rmno bed_app req1
29289 209 A 29723
29723 209 B 29289
29663 213 A 29804
29804 213 B 29663
28973 303 A 28974
28974 303 B 28973
29961 308 A 29876
29876 308 B 29961
29544 312 B 29588
28544 315 S 29849
29471 316 S 29364
27827 404 A 28086
28086 404 B 27827
28770 508 A 28680
28680 508 B 28770
29992 601 A 28777
29194 601 B 39860
28923 604 A 28925
28925 604 B 28923
29706 605 A 29611
29611 605 B 29706
29924 608 A 29927
29927 608 B 29924
27236 612 A 28831
28831 612 B 27236
28880 701 B 38137
29566 705 A 29393
29393 705 B 29566
29849 717 S 28544
28956 812 A 29937
29937 812 B 28956
29832 813 A 29174
29174 813 B 29832
29223 903 A 29406
29406 903 B 29223
29057 904 A 29401
29401 904 B 29057
28894 905 B 28869
29863 908 A 28840
28840 908 B 29863
29138 909 A 29366
I would much appreciate for any advice on how I should write such a programming in STATA.
Many thanks.
Thang
I am woking on residence data from a university. The full dataset include several residences with rooms and appartments for one to 4 students - a range of single rooms up to quadruple rooms or 4-bedroom appartments.I would want to generate a variabe which looks at the four variables and returns a match.
The four variables include the room number (rmno), the bed id (bed_app - denoting whether it's a double room with letters A and B or a single room with letter S), student id (id), and the id of the requested roommate(s) (req1 - a student can request up to 3 roommates, though I include in the below sample only the variable for the first requested roomate). The match I am looking for is the intersection between the two sets: set 1 of the room number (rmno) and student id (id), and set 2 of the room number and req1.
In the below sample, I looked at only one residence building, which offers either single or double rooms. This is a 10-storey building, of which a floor can consist of rooms numbered from 1 to 16 or 17 depending whether it is an odd or even floor, and rooms on the first three floors are usually limited, preserving the space for the administration. I sorted by the room number, and removed those who did not make a roommate request for the ease of data visualization.
As can be seen, some request were met, while some were not fulfiled by the administration. I am thinking of creating a perfect match (for a double room with two requests which were fulfilled), a partial match (for a triple or quadruple room with one or two fulfilled requests), and unfulfilled match, while keeping a full data set of those who did not make a roommate request.
id rmno bed_app req1
29289 209 A 29723
29723 209 B 29289
29663 213 A 29804
29804 213 B 29663
28973 303 A 28974
28974 303 B 28973
29961 308 A 29876
29876 308 B 29961
29544 312 B 29588
28544 315 S 29849
29471 316 S 29364
27827 404 A 28086
28086 404 B 27827
28770 508 A 28680
28680 508 B 28770
29992 601 A 28777
29194 601 B 39860
28923 604 A 28925
28925 604 B 28923
29706 605 A 29611
29611 605 B 29706
29924 608 A 29927
29927 608 B 29924
27236 612 A 28831
28831 612 B 27236
28880 701 B 38137
29566 705 A 29393
29393 705 B 29566
29849 717 S 28544
28956 812 A 29937
29937 812 B 28956
29832 813 A 29174
29174 813 B 29832
29223 903 A 29406
29406 903 B 29223
29057 904 A 29401
29401 904 B 29057
28894 905 B 28869
29863 908 A 28840
28840 908 B 29863
29138 909 A 29366
I would much appreciate for any advice on how I should write such a programming in STATA.
Many thanks.
Thang