I am trying to label names to ethics in my dataset A, so far I've collected all the names in my data and containing surnames in such format:
company Names
aaa jacky liu jenny xia
bbb benny chong alice wong
ccc ben chua larry Tse
What I can do is gen ethics = "Cantonese" if strpos(Names,"WONG""TSE"), and so on to generate a new variable to label each company. But I have another dataset B about all the surnames in different ethics. So I want to import that dataset to do it, then I don't need to manually type all the surnames in the strpos. What can I do?
The format of the separate dataset for all the surnames is in this format:
Mandarin Cantonese Hokkien ....
xxx xxx xxx
xxx xxx xxx
xxx xxx xxx
so the xxx represents each surname that may contain in the first dataset A.
Related Posts with How to label data by keywords using shortcuts?
Error: "numlist in operator invalid" while running suregHi, I have an unbalanced panel dataset. I'm receiving this error message "numlist in operator invali…
Convert "string" ID to numeric with non-numeric charactersI am trying to convert a non-numeric string ID variable to a numeric variable but I get an error mes…
Accessing function output that's displayed but not storedHi, I would like to store some of the output of the adjrr command in macros. The output is displayed…
Quick question on xtregHello. I quite new to using Stata. I am doing a regression with fixed effect and I was told to write…
How to remove the invisible space in the tail of a string in Stata?Hello, I have a small dataset below, clear input str80 No str90 Project "F-000508" "Hermann Park " "…
Subscribe to:
Post Comments (Atom)
0 Response to How to label data by keywords using shortcuts?
Post a Comment