Created
October 30, 2010 14:01
-
-
Save DataTwirling/655325 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *###############################################################. | |
| * Extract email domain from a field within SPSS data file. | |
| * BLOG: http://datatwirling.wordpress.com/. | |
| * TWITTER: @SPSSFanBoy | |
| * DATE: October 2010 | |
| * VERSION: SPSS v19.0.0 | |
| *###############################################################. | |
| * Let's create some fake data. | |
| DATA LIST FREE /email_field (A100). | |
| DATASET NAME temp.email. | |
| BEGIN DATA | |
| jermaine@conchords.com | |
| '' | |
| brett@conchords.edu | |
| homer@simpson.net.org | |
| antoinedodson | |
| END DATA. | |
| * Set the field to a string with a length of 100 charactsers. | |
| * Most likely way too many; skips '@' sign. | |
| DATASET ACTIVATE temp.email. | |
| STRING domain (A100). | |
| COMPUTE domain=CHAR.SUBSTR(email_field,CHAR.INDEX(email_field,'@')+1). | |
| EXECUTE. | |
| * Look at distribution by domain, ORDER BY count DESC. | |
| FREQ domain /FORMAT=DFREQ. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment