Hi everyone!
I have searched this forum and read the official stata help section, but I'm still not able to do what I want to do so I hope anyone here can help me.
My dataset consists of several variables of someones occupations in their professional career, measured at three points in time (each point in time equals one variable).
Now, for each variable there exist multiple occupations (entrepreneur, serial entrepreneur, investor, etc.) that can occur simultaneously.
An example occupation for one point in time might be "Entrepreneur" while for another observation it is "Investor, Serial Entrepreneur".
Now, I want to create a dummy variable "SubsequentEntrepreneur" that equals 1 if in any of these three strings contains the word "Entrepreneur" (or "Serial Entrepreneur") and 0 if it does not contain the phrase "Entrepreneur".
I think I need to use "strpos" but I have difficulties to connect the three variables (points in time). Maybe anyone has a suggestion?
I would be very grateful for any help!
Thank you very much,
Chris
Related Posts with generate dummy variable using strpos
replace groups of variables' valueDear Stata users, Suppose we have groups of variables whose values are coded as zero or one. Now we…
Cohen’s d from a regressionHello, I have a regression coefficient (using the reg command) that I would like to convert to Cohen…
count group var if a condition is metHello, I am using Stata 15.1 to analyse household survey data. I want to simply count the number of…
Converting the hazard coefficients to transition probabilities within multistate frameworkHi everyone, Within the multistate life table framework, I am trying to compute transition probabili…
Dropping panel dataHi, I am still new to stata and I have encountered problems. I have this set of data, I only want …
Subscribe to:
Post Comments (Atom)
0 Response to generate dummy variable using strpos
Post a Comment