Hi all,
I have a question about comparing two string variables. I wanted to compare the values of these variables row by row, to see if they contain any same elements. That is to say, for each row, they do not need to be exactly the same. As long as they have at least one same element, then the dummy variable indicating same elements should be 1 (it would be better if the number of same elements can be reported). For example, for the first row, if the value of var1 is A,B, and the value of var2 is A,B,D. Then, the value of the dummy variable is 1 since they have two same elements, A and B. How can I realize this using STATA?
Thanks for your answer in advance!
Best,
Yongli
Related Posts with How can I check if two string variables contain any same elements?
Advice on DiD using repeated cross sectional dataI have a question about treatment and control groups - DiD using repeated cross sectional data. If n…
incorrect panel data structureDear All, I am facing the following (incorrect) long panel data format. Code: * Example generated…
recording forward observations in panel dataDear Statalist, This is probably a trivial question, but I couldn't find a solution for it myself. …
Appending PDF documents using StataHello everyone, Hope you are well. I have a question regarding appending multiple documents and wh…
Interpreting an interaction term in a panel linear regression modelHi, I am exploring the link between the introduction of a stewardship policy and the consumption of…
Subscribe to:
Post Comments (Atom)
0 Response to How can I check if two string variables contain any same elements?
Post a Comment