I am trying to create a variable that captures which states have the most hospital admissions by hospital systems. I created a fake dataset here. I have variables for system ID, adjusted admissions by hospital, and state. I then created variables for total admissions by state at the system level and the max value at the system and state level. I am having trouble creating a column that has the state itself as opposed to a float of admissions
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int SystemID long AdjustedAdmissionsByHosp str2 State float(state_admission max_state_admission) 2100 594682 "DE" 594682 594682 2100 209468 "MI" 209468 594682 2100 128958 "NC" 128958 594682 2100 349834 "WI" 349834 594682 4500 12095 "CA" 12095 147367 4500 123958 "MN" 147367 147367 4500 23409 "MN" 147367 147367 4500 50968 "TX" 50968 147367 6500 2387350 "KS" 2387350 2387350 6500 2395 "MS" 2395 2387350 end label var SystemID "SystemID" label var AdjustedAdmissionsByHosp "AdjustedAdmissionsByHosp" label var State "State "
Comment