|
Hello all,
I'd like to count the number of characters in each value of one of my variables. Is there a quick and easy way to do this? Thanks! Nomi ===================== 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 |
|
Please explain in more detail.
I assume they are string variables. Are you asking about nonblank characters? Unique characters? Please give a few examples of strings and what you want the count to be. Art Kendall Social Research Consultants Nomi wrote: > Hello all, > I'd like to count the number of characters in each value of one of my > variables. > Is there a quick and easy way to do this? > Thanks! > Nomi > > ===================== > 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
Art Kendall
Social Research Consultants |
|
In reply to this post by Nomi-2
Prior to release 16:
compute countvar=length(rtrim(stringvar)). Release 16 or later: compute countvar=char.length(stringvar). The character count will include everything except trailing blanks. (So the count includes leading blanks or blanks between characters.) -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Nomi Sent: Monday, March 16, 2009 12:06 PM To: [hidden email] Subject: Counting characters of values Hello all, I'd like to count the number of characters in each value of one of my variables. Is there a quick and easy way to do this? Thanks! Nomi ===================== 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 |
|
In reply to this post by Nomi-2
Open a new instance of SPSS. Copy the syntax below to a syntax file.
Click <run>. Click <all>. look at the variations in the input and the resulting count of character data list list/ the_id (a20). begin data 002345678 2345678 2345678 12345678 012345678 123456789 234567890 345678901 '123 123111' '456 789' 4567 1234567890 234567890123 4567890123 end data. compute mydigits= length(ltrim(rtrim(the_id))). formats mydigits(f2). frequencies vars=mydigits. list. Art Kendall Social Research Consultants The Werbeloffs wrote: > It is an ID variable (string). It should ideally have 9 digits but > Some values have more and some less. Those that are less don't pose a > > problem but I'd like to locate those with more than 9 characters. > > Thanks! > > > Dr. Nomi Werbeloff | m: 054 488-8703| f: 09 7715330| [hidden email] > > Save a tree - think before you print! > -----Original Message----- > From: Art Kendall [mailto:[hidden email]] > Sent: Monday, March 16, 2009 8:17 PM > To: Nomi > Cc: [hidden email] > Subject: Re: Counting characters of values > > Please explain in more detail. > I assume they are string variables. Are you asking about nonblank > characters? Unique characters? > Please give a few examples of strings and what you want the count to > be. > > Art Kendall > Social Research Consultants > > > Nomi wrote: > > Hello all, > > I'd like to count the number of characters in each value of one of > my > > variables. > > Is there a quick and easy way to do this? > > Thanks! > > Nomi > > > > ===================== > > 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 |
