Hi all,
I'm currently trying to create a dummy variable, inlaborforce, using the below code:
gen inlaborforce = 0
replace inlaborforce = 1 if labforce == "Yes, in the labor force"
replace inlaborforce = . if labforce == "NIU"
I'm seeing similar if not identical syntax in guides / forums, but I'm get a type mismatch error. Tried to destring but both variables are numerical so that didn't work.
Sorry if this is too basic a question. Thanks,
Related Posts with Type mismatch issues with generating / replacing
 Using time series data where observation dates do not alignI am in the currently writing my dissertation in which I need to forecast future GDP growth using as… Using time series data where observation dates do not alignI am in the currently writing my dissertation in which I need to forecast future GDP growth using as…
 Generate variables to capture heat stressDear all
I have daily minimum and maximum temperature data from 697 weather stations across 311 dist… Generate variables to capture heat stressDear all
I have daily minimum and maximum temperature data from 697 weather stations across 311 dist…
 Dropping observations based on multiple conditionsHi. I am pasting a sample of the date of I am working with:
Code:
* Example generated by -dataex-.… Dropping observations based on multiple conditionsHi. I am pasting a sample of the date of I am working with:
Code:
* Example generated by -dataex-.…
 Expanding rows by number sequenceI'm trying to rearrange the database below. I am looking for a command that extracts each number in … Expanding rows by number sequenceI'm trying to rearrange the database below. I am looking for a command that extracts each number in …
 datetime translationHello,
I'm facing trouble telling stata the format of my time variable.
My time variable "time" has… datetime translationHello,
I'm facing trouble telling stata the format of my time variable.
My time variable "time" has…
Subscribe to:
Post Comments (Atom)
0 Response to Type mismatch issues with generating / replacing
Post a Comment