|
Hope there is someone who can answer my question.
I'm no SPSS braniac to begin with. But I think this should be pretty easy to do. (even though I can't find anything about it on the internet) I have a file with Postal codes (Zip Codes) from the UK HP12 4QS WD18 0QB NG10 5FZ BD3 2GZ <<< Want to select these BN27 3UY DE3 5NS AB2 3BD <<< Do NOT want to select these CB1 2ND LE8 B31 5PB CO4 3SQ B48 7PS DA12 2LQ BD20 0BQ <<< Want to select these I want to select all Postal codes that begin with "BD" I have tried the "IF INDEX" but it will also give me postal codes with BD on the end or in between. Hopefully someone has a syntax to search a string for this. It would also be nice to know how to find cases that end on (for example) "BD" (for any future research) I want to do this with a syntax since we are talking about more then 400.000 cases and manually ascending by hand will be a lot of work. Thanks in advance! ===================== 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 |
|
Untested syntax
Select if ( ( substr ( ( ltrim ( rtrim ( postcode ))), 1, 2 ) eq 'BD' ) The Ltrim & Rtrim or to remove leading and trailing spaces, I always do that for 'belt and braces', and the Substr chops out the first two characters!! Best Wishes John S. Lemon DIT - Student Liaison Officer University of Aberdeen Edward Wright Building: Room G51 Tel: +44 1224 273350 Fax: +44 1224 273372 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Teun Rox Sent: 19 March 2008 17:29 To: [hidden email] Subject: Searching string for cases that begin with... Hope there is someone who can answer my question. I'm no SPSS braniac to begin with. But I think this should be pretty easy to do. (even though I can't find anything about it on the internet) I have a file with Postal codes (Zip Codes) from the UK HP12 4QS WD18 0QB NG10 5FZ BD3 2GZ <<< Want to select these BN27 3UY DE3 5NS AB2 3BD <<< Do NOT want to select these CB1 2ND LE8 B31 5PB CO4 3SQ B48 7PS DA12 2LQ BD20 0BQ <<< Want to select these I want to select all Postal codes that begin with "BD" I have tried the "IF INDEX" but it will also give me postal codes with BD on the end or in between. Hopefully someone has a syntax to search a string for this. It would also be nice to know how to find cases that end on (for example) "BD" (for any future research) I want to do this with a syntax since we are talking about more then 400.000 cases and manually ascending by hand will be a lot of work. Thanks in advance! ===================== 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 The University of Aberdeen is a charity registered in Scotland, No SC013683. ===================== 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 |
| Free forum by Nabble | Edit this page |
