Hello,
I am a new Stata user and I'm currently using Stata 15.1. I am trying to replace some of the values in my data. I have two variables that indicate the lowest grade offered (gslo) in a school, and the highest grade offered (gshi) in a school. I also have about 260 variables that simultaneously indicate a student's ethnicity, grade and gender i.e. ampkm is American Indian Pre-K male.
Gslo and gshi are categorical variables that include observations from "pk" to "12". I need to replace observations for the ethnicity variables based on the highest and lowest grade offered. For example, if a school offers 5th through 12th grade, and ampkm has a value of 0, it should be replaced with .n, as in not applicable.
I have tried:
However, I have found that this will only replace observations if the lowest grade is 5th and the highest grade is 12th, rather than 5th through 12th grade.
How may I go about doing this so I can replace the variables based on a range?
Thanks in advance,
Brianna
I am a new Stata user and I'm currently using Stata 15.1. I am trying to replace some of the values in my data. I have two variables that indicate the lowest grade offered (gslo) in a school, and the highest grade offered (gshi) in a school. I also have about 260 variables that simultaneously indicate a student's ethnicity, grade and gender i.e. ampkm is American Indian Pre-K male.
Gslo and gshi are categorical variables that include observations from "pk" to "12". I need to replace observations for the ethnicity variables based on the highest and lowest grade offered. For example, if a school offers 5th through 12th grade, and ampkm has a value of 0, it should be replaced with .n, as in not applicable.
I have tried:
Code:
sort gslo gshi
Code:
replace ampkm =.n if gslo == "05" & gshi == "12"
How may I go about doing this so I can replace the variables based on a range?
Thanks in advance,
Brianna
Comment