Dear Statalist Users,
This is my first time on Statalist, so I apologize in advance if this is not the place to ask my question. I have a very short question to ask. I have to work on a panel of data on graduate subjects with bachelors, masters, etc.
In order to isolate the public universities (let's call it publicU) from private ones, I tried to implement a code to remove only the public universities. However, when trying to implement a loop, the code does not work:
forval publicU= 309|328|334|335|339|354 {
gen new_`publicU'=1 if ts==`publicU'
replace new_`publicU'=0 if ts~=`publicU'
}
ts represents the codes that represent each university individually which interests me.
What would be a way to loop only on the above values, please?
Thank you very much in advance for your answer and help. Have a nice day.
Best regards,
Michael
This is my first time on Statalist, so I apologize in advance if this is not the place to ask my question. I have a very short question to ask. I have to work on a panel of data on graduate subjects with bachelors, masters, etc.
In order to isolate the public universities (let's call it publicU) from private ones, I tried to implement a code to remove only the public universities. However, when trying to implement a loop, the code does not work:
forval publicU= 309|328|334|335|339|354 {
gen new_`publicU'=1 if ts==`publicU'
replace new_`publicU'=0 if ts~=`publicU'
}
ts represents the codes that represent each university individually which interests me.
What would be a way to loop only on the above values, please?
Thank you very much in advance for your answer and help. Have a nice day.
Best regards,
Michael

Comment