Recoding with conditional statements in STATA. Sorry if this is a repost but I have looked extensively and i cant figure out how to write out the command i need.
Basically, I have am looking at arrests and I have CensusTract variable that has values from 1-27 that correspond to to different census neighborhoods the crime occurred in. I want to analyze these arrests based on the neighborhood characteristics of where they occurred. I created variables for Percent Black, Percent unemployed, Percent bachelors degree etc. I need to apply the characteristics of each census neighborhood to the variables I created.
I attempted the following with no luck.
recode PercentBlack= .78 if CensusTract==2
Also, if there is a way to recode all at once so i could just do one command for each of the 27 neighborhood. Something like "if census tract = 3 then PercentBlack = .88, PercentUnemployed=.55, PercentBachelors=.22" that would be even better.
Thanks for any advice.
Basically, I have am looking at arrests and I have CensusTract variable that has values from 1-27 that correspond to to different census neighborhoods the crime occurred in. I want to analyze these arrests based on the neighborhood characteristics of where they occurred. I created variables for Percent Black, Percent unemployed, Percent bachelors degree etc. I need to apply the characteristics of each census neighborhood to the variables I created.
I attempted the following with no luck.
recode PercentBlack= .78 if CensusTract==2
Also, if there is a way to recode all at once so i could just do one command for each of the 27 neighborhood. Something like "if census tract = 3 then PercentBlack = .88, PercentUnemployed=.55, PercentBachelors=.22" that would be even better.
Thanks for any advice.
Comment