Hello, I have problem, I have a variable named dup_casnum which lists the duplicated case numbers, I need to specify some complex commands, If there is an instance where phonetype has 1 cell phone entry as well as other entries, I will retain only the cell phone entries, if there is a case where the duplicates have no cell phone entry but "Other" I will retain "Other" if there is an entry with "home" and "work" I will retain only the "home" entry and so forth. so in a situation like the one shown above the code, I will only retain the "cell" entry and delete the other phone types, in a second situation where there is no "Cell" like in the "SAPD24009076" casenumber I will retain only the "Other" entry and delete "Home". I hope this makes sense
"SAPD24010220" "Work"
"SAPD24010220" "Other"
"SAPD24010220" "Cell"
"SAPD24010220" "Home"
"SAPD24009076" "Other"
"SAPD24009076" "Home"
"SAPD24009076" "Home"
"SAPD24010220" "Work"
"SAPD24010220" "Other"
"SAPD24010220" "Cell"
"SAPD24010220" "Home"
"SAPD24009076" "Other"
"SAPD24009076" "Home"
"SAPD24009076" "Home"
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str12 dup_casenum str16 PHONETYPE "" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Other" "" "Cell" "" "Cell" "SAPD24001556" "" "SAPD24001556" "Cell" "" "Other" "" "Cell" "" "Cell" "" "Cell" "" "Other" "" "Other" "" "Other" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Other" "" "Cell" "" "Cell" "" "Cell" "" "Other" "" "Cell" "" "Cell" "" "Home" "" "Cell" "" "Other" "" "Cell" "" "Other" "" "Other" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Other" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "SAPD24007083" "Cell" "SAPD24007083" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "SAPD24007908" "Work" "SAPD24007908" "Other" "" "Cell" "SAPD24008281" "Cell" "SAPD24008281" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "SAPD24009076" "Other" "SAPD24009076" "Home" "SAPD24009076" "Home" "" "Cell" "" "Cell" "SAPD24009638" "Cell" "SAPD24009638" "Cell" "SAPD24009638" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "SAPD24009906" "Other" "SAPD24009906" "Home" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "SAPD24010220" "Work" "SAPD24010220" "Other" "SAPD24010220" "Cell" "SAPD24010220" "Home" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "SAPD24011302" "Cell" "SAPD24011302" "Work" "" "Cell" "" "Cell" "" "Cell" "" "Cell" "SAPD24012030" "Work" "SAPD24012030" "Cell" "" "Cell" "SAPD24012182" "Cell" "SAPD24012182" "Cell" "SAPD24012672" "Cell" "SAPD24012672" "Cell" end
Comment