Hey Stata Community,
I'm looking for a way to generate a variable depending on the "4 last letters" of another variable.
Example:
My variable has car names like "VW" or "AUDI", but sometimes the variable also says "VW FGDT" (4 random letters behind the car name, no model specifications).
How can I generate a new variable that is "1" if there is this random 4 letter code behind the car name? Is there something like a "placeholder" I can use for these random 4 letters?
Best regards,
Milena
Related Posts with Stata Code
Generating geographical group variables from Household IDHi, I am using STATA 14, I am interested in generating a new variable from household ID, which is a…
Cleaning of dataHi, I am working with a set of panel data and are trying to do some cleaning of my data so that I ca…
Getting two columns in the data file after running mfx2Dear all, I estimate a probit model and them I use the mfx2 to get the marginal effects at the mean…
treated unit not found in panelvar - check tr(). error helpHello, I am using the synth.ado file and I am attempting to run a placebo test and I continue to ge…
Propensity Score MatchingHi everyone, I am still figuring out PSM for my study.I am having trouble in the first step matchin…
Subscribe to:
Post Comments (Atom)
0 Response to Stata Code
Post a Comment