Hi, all,
I got two variables, say X and Y. The value in X is with different orders of A, B and C, say ACB or BCA. I want to compare this with variable "Y", which has one only value of "ABC". Essentially, "ACB" is the same as "ABC". My question is how to compare X and Y? is there any way to rearrangethe value in X and then compare? Any advice is appeciated. Thanks, |
I do not understand what you are trying to do. There are 6 members of the ABC permutation set. The frequencies output for X shows one or more examples of each of those 6 members. At the same time the frequencies output for Y shows one value: ABC. You say ' Essentially, "ACB" is the same as "ABC".' Why is ACB the same as ABC? Is BCA the same as ABC? What is the rule for deciding that a value of X equals ABC?
Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of albert_sun Sent: Monday, April 28, 2014 10:15 PM To: [hidden email] Subject: How to compare this with syntax? Hi, all, I got two variables, say X and Y. The value in X is with different orders of A, B and C, say ACB or BCA. I want to compare this with variable "Y", which has one only value of "ABC". Essentially, "ACB" is the same as "ABC". My question is how to compare X and Y? is there any way to rearrangethe value in X and then compare? Any advice is appeciated. Thanks, -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-to-compare-this-with-syntax-tp5725696.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Administrator
|
In reply to this post by albert_sun
Taking your example very literally (i.e., assuming 3-letter strings, all in uppercase), you could do something like this:
* Generate some sample data. DATA LIST list / X Y (2A3). BEGIN DATA ABC ABC ABC ACB ABC BCA ABC BCD END DATA. LOOP # = 1 to 3. - COMPUTE Perm = CHAR.INDEX(Y,CHAR.SUBSTR(X,#,1)) GT 0. END LOOP if not Perm. FORMATS Perm(f1). LIST. Output: X Y Perm ABC ABC 1 ABC ACB 1 ABC BCA 1 ABC BCD 0 Number of cases read: 4 Number of cases listed: 4 If they are not all 3-letter strings (all uppercase), you'll have to make adjustments to take that into account.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Administrator
|
Well done!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Thanks all your wisdom. This is exactly what I want. On Wed, Apr 30, 2014 at 1:48 AM, David Marso [via SPSSX Discussion] <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |