Hi,
I am working with IBM SPSS Statistics 19 and have a question. I have a series of many (>1000) string variables and I want to create a variable that counts the number of times a value occurs in 1 row (across each of these columns). How do I do that? Thank-you in advance! |
I will be out of the office on Monday, September 19. I will reply to your e-mail when I return on Tuesday, September 20.
Jeff ____________________________ Jeff Allum Research Associate Council of Graduate Schools One Dupont Circle, NW, Suite 230 Washington, DC 20036-1173 (202) 461-3878 (direct) (202) 223-3791 (main) (202) 461-3879 (fax) [hidden email]<mailto:[hidden email]> www.cgsnet.org<http://www.cgsnet.org/> ===================== 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 |
Administrator
|
In reply to this post by Alexa
See COUNT command.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by Alexa
The syntax reference has a slightly confusing example:
COUNT SVAR=V1 V2 ('male ') V3 V4 V5 ('female'). . . in which v1 to v5 are A6 format and svar will be f8.2 (by default). The variables in the source list must be all numeric (not your problem) or all string. This command will count for both 'male ' and 'female' and svar will range from 0 to 5, but it won't tell you how many males and how many females there are. Seems a pretty pointless example to me. Why only two vars for 'male ' and three for 'female'? It would be better as: Count males = v1 v2 ('male ') /females = v3 to v5 ('female') . . . in which males will range from 0 to 2 and females from 0 to 3. You can always add them together later. Not quite sure what you do if you need to pick out a substring. John F Hall [hidden email] www.surveyresearch.weebly.com -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Alexa Sent: 17 September 2011 01:56 To: [hidden email] Subject: Counting the number of times a value appears across multiple variables (columns) Hi, I am working with IBM SPSS Statistics 19 and have a question. I have a series of many (>1000) string variables and I want to create a variable that counts the number of times a value occurs in 1 row (across each of these columns). How do I do that? Thank-you in advance! -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Counting-the-number-of-times-a -value-appears-across-multiple-variables-columns-tp4812423p4812423.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== 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 Alexa
If you have long strings and if you want to match
the _whole_ string it would involve less typing to
1) autorecode with the /group option 2) do a MULT RESPONSE with the /table option to find which strings ever occur more than once 3) if you need the counts as variables then write the series of COUNT commands. If you need to count substrings, please post a more detailed description. E.g., do you know ahead of time what substrings you want to count the occurrence of? Are all of the strings the same length? Art Kendall Social Research Consultants On 9/16/2011 7:56 PM, Alexa wrote: ===================== 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 REFCARDHi, I am working with IBM SPSS Statistics 19 and have a question. I have a series of many (>1000) string variables and I want to create a variable that counts the number of times a value occurs in 1 row (across each of these columns). How do I do that? Thank-you in advance! -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Counting-the-number-of-times-a-value-appears-across-multiple-variables-columns-tp4812423p4812423.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== 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 |
Administrator
|
In reply to this post by John F Hall
"Not quite sure what you do if you need to pick out a substring."
See INDEX function and DO REPEAT!!.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by David Marso
Thanks. From: David Marso [via SPSSX Discussion] [mailto:[hidden email]] See COUNT command. Alexa wrote: Hi, If you reply to this email, your message will be added to the discussion below: To unsubscribe from Counting the number of times a value appears across multiple variables (columns), click here. |
Free forum by Nabble | Edit this page |