Hello, I am following this tread and hope that it can lead to an answer to my question. The problem is very similar with one minor adjustment. I am looking to collapse by multiple variables. I am looking to match up each of the agency names by the different variables (disability senior medicaltransport, etc.) by city/territories. For example, each agency name will be duplicated in a new variable (i.e., disability_v2, senior_v2, medicaltransport_v2, etc.). This will give me the offered agency names per city/territory by the service provided (disability, senior, etc.).
Below is an example of what I am looking for.
Below is a sample of the dataset I am working with. Thank you for all your help with this.
* Example generated by -dataex-. For more info, type help dataex
clear
input str16 cityterritories str60 agencyname str1(disability senior medicaltransport taxi paratransit)
"Andover" "ANDOVER, TOWN OF" "x" "x" "x" "" ""
"Andover" "ACE TAXI SERVICE, INC. (TAXI)" "x" "x" "x" "x" ""
"Andover" "MANCHESTER CAB LLC" "x" "x" "x" "x" ""
"Ansonia" "Valley Transit District (VTD)" "" "" "" "" "x"
"Ashford" "TOWN OF ASHFORD" "" "x" "" "" ""
"Ashford" "PUTNAM TAXI, LLC" "" "" "" "x" ""
"Ashford" "Windham Regional Transit District (WRTD)" "" "" "" "" "x"
Below is an example of what I am looking for.
New Table | ||||
Town | Disab_Agencies | Senior_Agencies | Paratransit_Agencies | |
Andover | ANDOVER, TOWN OF; ACE TAXI SERVICE, INC. (TAXI) | ANDOVER, TOWN OF; ACE TAXI SERVICE, INC. (TAXI) | MANCHESTER CAB LLC | |
Below is a sample of the dataset I am working with. Thank you for all your help with this.
Code:
dataex cityterritories agencyname disability senior medicaltransport taxi paratransit
clear
input str16 cityterritories str60 agencyname str1(disability senior medicaltransport taxi paratransit)
"Andover" "ANDOVER, TOWN OF" "x" "x" "x" "" ""
"Andover" "ACE TAXI SERVICE, INC. (TAXI)" "x" "x" "x" "x" ""
"Andover" "MANCHESTER CAB LLC" "x" "x" "x" "x" ""
"Ansonia" "Valley Transit District (VTD)" "" "" "" "" "x"
"Ashford" "TOWN OF ASHFORD" "" "x" "" "" ""
"Ashford" "PUTNAM TAXI, LLC" "" "" "" "x" ""
"Ashford" "Windham Regional Transit District (WRTD)" "" "" "" "" "x"
Comment