Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str171 q12m str155 q14m str171(q16m q18m) `""g","a""' `""e""' `""g","a""' `""g","c","a""' `""g","c","a""' `""g","c","a""' `""g","c","a""' `""g","c","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","c""' `""e""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","b""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""g","c""' `""g","a""' `""g","a""' `""g","a""' `""g","a""' `""e""' `""e""' `""g","a""' `""g","a""' `""e""' `""g","a""' `""g","a""' `""g","a""' `""e""' `""g","a""' `""g","a""' `""g","a""' `""e""' `""g","a""' `""g","a""' `""g","a""' `""e""' `""e""' `""g","a""' `""g","a""' `""e""' `""e""' `""g","a""' end
Code:
+-------------------------------------------------------+ | q12m q14m q16m q18m | |-------------------------------------------------------| 1. | "g","a" "e" " "," " " ","c"," " |
I thought that I might be able to achieve this with inlist:
Code:
replace q14m = "" if inlist(q14m,q12m) replace q16m = "" if inlist(q16m,q12m) replace q18m = "" if inlist(q18m,q12m)
Code:
-----------------------------------------------+ | q12m q14m q16m q18m | |-----------------------------------------------| 1. | "g","a" "e" "g","c","a" | 2. | "g","c","a" |
Martyn
0 Response to Matching components of string variables
Post a Comment