#A simple function to normalize a variable to range(0,1)
normalize <- function(x) {
return ((x - min(x)) / (max(x) - min(x)))
}
#Can be apply to Stata as follows: here `college_degree` is rate of college degree in each state
egen maxcoll = max(college_degree_round )
egen mincoll = min(college_degree_round )
ge college_degree_normalize = (college_degree - mincoll )/(maxcoll - mincoll )