Hello. I'm working with US Census data in Stata 15.1. Each observation is a geographic area and the variables are the percentage of the population placed in several race/ethnicity categories. The percentages are in the format 12.34. I want a new variable with the percentage from the category with the highest percentage. I'm using the following command:
Code:
egen rowmax=rowmax(pctapi pctblack pctaian pctwhite pct2prace pcthispanic)
However, if "pctwhite," for instance, is 55.19, "rowmax" = 55.189999. This creates a problem when I want to create a variable that contains "pctwhite" as the value to indicate the race/ethnicity category that "rowmax" came from. Hope that makes sense. I don't know if I
Code:
egen rowmax
has a fix for this. I tried rounding manipulations with
Code:
int
but that seemed to produce a few records with "rowmax" off by 0.01 from the source variable. Thank you for any suggestions.