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?
Propensity Score with TEFFECTS / IPWRA: is it possible to create a bar graph showing covariate balancing?In looking through the TEFFECTS help files & PDF manual, I do see that a graph of individual cov…
Difference between the two options under model two tab for three stage least squares?In stata after going to statistics-->endogenous covariates ---> Three stage least squares and …
Sample size calculation using one sided test with power commandHello all, I am trying to run a test to determine the sample size where the outcome is proportions …
Assigning dates and days of week in a long datasetHello, I have a long dataset with observations that represent all of the days that a person was enr…
Creating summary statistic tables with multiple variables with multiple super-columns.Hi all, I am trying to replicate the results of a paper, and I am having trouble creating nicely fo…
Subscribe to:
Post Comments (Atom)
0 Response to How can I check if two string variables contain any same elements?
Post a Comment