|
I want to flag records that have a constant number in many variables
using AND logic but can't find an elegant way. Is there a command like ANY that works with AND rather than OR ? Example - If (v1=5 & v2=5 & v3=5......................& vx=5) Flag1 = 1. I want to do the above for many variables - any short cuts ? -- Mark Webb Line +27 (21) 786 4379 Cell +27 (72) 199 1000 Fax to email +27 (86) 5513075 Skype webbmark Email [hidden email] ===================== 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 |
|
Mark Webb wrote:
> I want to flag records that have a constant number in many variables > using AND logic but can't find an elegant way. > Is there a command like ANY that works with AND rather than OR ? > Example - > If (v1=5 & v2=5 & v3=5......................& vx=5) Flag1 = 1. > I want to do the above for many variables - any short cuts ? Hi Mark: A totally different approach: records with constant data will have 0 standard deviation. COmpute a new variable with the SD (I thing that compute has a function for it) and flag those record with SD=0. HTH, Marta GG > > -- > Mark Webb > > Line +27 (21) 786 4379 > Cell +27 (72) 199 1000 > Fax to email +27 (86) 5513075 > Skype webbmark > Email [hidden email] > > ===================== > 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 > -- For miscellaneous SPSS related statistical stuff, visit: http://gjyp.nl/marta/ ===================== 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 |
|
Mark Webb wrote:
> Thanks Marta - but all constant numbers will have a SD = 0 & I only > want those with 5's. > My solution [poor] is - I have 54 variables - if I add them up into a > variable - sum(var1 to var54) those with ALL 5's will total 54x5=270. > It works - but not great. Then use a filter that discards those records with SD=0 and v1=5 (since the only way you can have an SD of 0 when the first variable is 5 is that all values are 5). HTH, Marta GG > > Mark Webb > > Line +27 (21) 786 4379 > Cell +27 (72) 199 1000 > Fax to email +27 (86) 5513075 > Skype webbmark > Email [hidden email] > > > On 2010/08/17 12:28 PM, Marta García-Granero wrote: >> Mark Webb wrote: >>> I want to flag records that have a constant number in many variables >>> using AND logic but can't find an elegant way. >>> Is there a command like ANY that works with AND rather than OR ? >>> Example - >>> If (v1=5 & v2=5 & v3=5......................& vx=5) Flag1 = 1. >>> I want to do the above for many variables - any short cuts ? >> Hi Mark: >> >> A totally different approach: records with constant data will have 0 >> standard deviation. COmpute a new variable with the SD (I thing that >> compute has a function for it) and flag those record with SD=0. >> >> HTH, >> Marta GG >>> >>> -- >>> Mark Webb >>> >>> Line +27 (21) 786 4379 >>> Cell +27 (72) 199 1000 >>> Fax to email +27 (86) 5513075 >>> Skype webbmark >>> Email [hidden email] >>> >>> ===================== >>> 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 >>> >> >> >> -- >> For miscellaneous SPSS related statistical stuff, visit: >> http://gjyp.nl/marta/ >> >> ===================== >> 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 >> > -- For miscellaneous SPSS related statistical stuff, visit: http://gjyp.nl/marta/ ===================== 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
|
Mark, what do you want to do in case of missing data? E.g., suppose a record has missing data on one or more of the variables, but all 5's otherwise?
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
| Free forum by Nabble | Edit this page |
