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
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
Comment