|
Hello Group,
I have a set of e-mail addresses and I would like to remove all characters after the @ symbol(including the @). My current data: [hidden email] [hidden email] [hidden email] I need data to look like this: jobosn hbhskoos skiodeeej I'm not sure how to proceed. Any help would be great. Thanks, MK ===================== 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 |
|
I'm certain someone will have a more elegant solution, but here is some
syntax that I have used in the past to do something similar. I called your email address field "email" and the resulting field "name". ** Compute the position of the last character before the "@" symbol. ** I called this CharPos. COMPUTE CharPos = RINDEX(RTRIM(email),"@")-1. FORMATS CharPos (F3.0). EXECUTE . ** Use that in a Macro. DEFINE !CharPos() CharPos !ENDDEFINE. ** Use the Macro and a substring command to select all the characters in ** front of the @ symbol. COMPUTE name =LTRIM(SUBSTR(email,1,!CharPos)). EXE. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of subscribe SPSSX-l Anonymous Sent: Thursday, February 26, 2009 2:08 PM To: [hidden email] Subject: Removing Strings Hello Group, I have a set of e-mail addresses and I would like to remove all characters after the @ symbol(including the @). My current data: [hidden email] [hidden email] [hidden email] I need data to look like this: jobosn hbhskoos skiodeeej I'm not sure how to proceed. Any help would be great. Thanks, MK ===================== 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 ---------------- Defender MX4 - QLAN ===================== 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 MK and Heidi,
Perhaps I don't understand correctly, but it seems to me that you don't need the macro: string frontbit (A20). compute frontbit = substr(email,1, RINDEX(email,"@")-1). execute. Cheers, Simon On 27/02/2009, at 9:33 AM, Heidi Green wrote: > I'm certain someone will have a more elegant solution, but here is > some > syntax that I have used in the past to do something similar. > > I called your email address field "email" and the resulting field > "name". > > > ** Compute the position of the last character before the "@" symbol. > ** I called this CharPos. > > COMPUTE CharPos = RINDEX(RTRIM(email),"@")-1. > FORMATS CharPos (F3.0). > EXECUTE . > > ** Use that in a Macro. > DEFINE !CharPos() CharPos !ENDDEFINE. > > ** Use the Macro and a substring command to select all the > characters in > ** front of the @ symbol. > > COMPUTE name =LTRIM(SUBSTR(email,1,!CharPos)). > EXE. > > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:[hidden email]] On > Behalf Of > subscribe SPSSX-l Anonymous > Sent: Thursday, February 26, 2009 2:08 PM > To: [hidden email] > Subject: Removing Strings > > Hello Group, > > I have a set of e-mail addresses and I would like to remove all > characters > after the @ symbol(including the @). > > > My current data: > > [hidden email] > [hidden email] > [hidden email] > > > I need data to look like this: > > jobosn > hbhskoos > skiodeeej > > I'm not sure how to proceed. Any help would be great. > > Thanks, > > MK > > ===================== > 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 > > ---------------- > > Defender MX4 - QLAN > > ===================== > 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 --- Simon Palmer http://www.strategicdata.com.au/ Phone: +61 3 9340 9000 Fax: +61 3 9348 2015 ===================== 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 |
|
In reply to this post by subscribe SPSSX-l Anonymous-2
MK ...Does this work for you?
DATA LIST FREE /EMAIL (A30). BEGIN DATA. [hidden email] [hidden email] [hidden email] END DATA. COMPUTE WHEREAT = CHAR.INDEX(EMAIL, "@"). STRING NAME (A20). COMPUTE NAME = CHAR.SUBSTR(EMAIL,1,(WHEREAT-1)). EXE. Art -----Original Message----- From: subscribe SPSSX-l Anonymous [mailto:[hidden email]] Sent: Thursday, February 26, 2009 2:08 PM To: [hidden email] Subject: Removing Strings Hello Group, I have a set of e-mail addresses and I would like to remove all characters after the @ symbol(including the @). My current data: [hidden email] [hidden email] [hidden email] I need data to look like this: jobosn hbhskoos skiodeeej I'm not sure how to proceed. Any help would be great. Thanks, MK ===================== 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 |
| Free forum by Nabble | Edit this page |
