|
Hi all,
I have more than 28 thousand cases. How to check if values of two string variables match for each case? For example, Case# var1 var2 var3 1 XXX XXX match 2 YXY XYY not match 3 match but empty 4 match but empty 5 WWW WWW match In that example, I created a fourth variable var3 to indicate whether values of var1 matches with var2 for each case. Thanks. Johnny Adding more friends is quick and easy.</a><br>Import them over to Yahoo! Mail today! http://www.trueswitch.com/yahoo-ph ====================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 |
|
Hi Johnny,
compute var3=(var1 eq var2). /* means that if var1=var2 then var3=1, if not, var3=0. if (var1=' ' or var2=' ') var3=2. /* if one or two are missing, then var3=2. if (var1=' ' and var2=' ') var3=3. /* optional – if both are missing code as "3", in case you want to differentiate between one missing value and two missing values Nirit -----הודעה מקורית----- מאת: SPSSX(r) Discussion [mailto:[hidden email]] בשם Johnny Amora נשלח: Thursday, January 29, 2009 11:35 AM אל: [hidden email] נושא: Matching values of two string variables Hi all, I have more than 28 thousand cases. How to check if values of two string variables match for each case? For example, Case# var1 var2 var3 1 XXX XXX match 2 YXY XYY not match 3 match but empty 4 match but empty 5 WWW WWW match In that example, I created a fourth variable var3 to indicate whether values of var1 matches with var2 for each case. Thanks. Johnny Adding more friends is quick and easy.</a><br>Import them over to Yahoo! Mail today! http://www.trueswitch.com/yahoo-ph ======= 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 |
|
Actually to make sure that var3=0 in case var1<>var2 you should add to Nirit's syntax:
if var1<>var2 var3=0. Otherwise var3 will contain some missing values. Cheers, Luca www.lucameyer.com - http://collaborate2innovate.blogspot.com/ -----Messaggio originale----- Da: SPSSX(r) Discussion [mailto:[hidden email]] Per conto di Nirit Inviato: giovedì 29 gennaio 2009 12.50 A: [hidden email] Oggetto: תשובה: Matching values of two string variables Hi Johnny, compute var3=(var1 eq var2). /* means that if var1=var2 then var3=1, if not, var3=0. if (var1=' ' or var2=' ') var3=2. /* if one or two are missing, then var3=2. if (var1=' ' and var2=' ') var3=3. /* optional – if both are missing code as "3", in case you want to differentiate between one missing value and two missing values Nirit -----הודעה מקורית----- מאת: SPSSX(r) Discussion [mailto:[hidden email]] בשם Johnny Amora � שלח: Thursday, January 29, 2009 11:35 AM אל: [hidden email] � ושא: Matching values of two string variables Hi all, I have more than 28 thousand cases. How to check if values of two string variables match for each case? For example, Case# var1 var2 var3 1 XXX XXX match 2 YXY XYY not match 3 match but empty 4 match but empty 5 WWW WWW match In that example, I created a fourth variable var3 to indicate whether values of var1 matches with var2 for each case. Thanks. Johnny Adding more friends is quick and easy.</a><br>Import them over to Yahoo! Mail today! http://www.trueswitch.com/yahoo-ph ======= 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 ===================== 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 |
Show off your style with new cool skins. Try the all-new Yahoo! Messenger 9.0 today! |
| Free forum by Nabble | Edit this page |
