Banned User
|
CONTENTS DELETED
The author has deleted this message.
|
Simple syntax: Missing values H3WP19 (). IF (H3WP19=96 or if H3WP19=97 or if H3WP19=99) H3WP19=H3WP31. I include the MISSING VALUES command to cancel any user-declared missing values, just in case you had declared the values 96, 97 and 99 as missing. In that case, The IF command would not work in cases with those values if they are missing, because cases with missing values are ignored in IF commands as the above. After applying the above syntax you can define again your missing values for H3WP19. Hector De: SPSSX(r) Discussion [mailto:[hidden email]] En nombre de Buhi, Eric Good evening all. I am trying to compute a new variable, by using the responses of two variables. Specifically, I would like to create WarmMom, such that if H3WP19 is not answered (e.g., 96, 97, 99), then it will substitute, or use the value for H3WP31 (below). Does anyone know what syntax commands I'd use? H3WP19 Most of the time {residential mom} is warm and loving toward you 1=SA, 2=Agree, 3=Neither A or D, 4=Disagree, 5=SD, 96=refused, 97=legit skip,99=not appl H3WP31 Most of the time {mom you used to live with} is warm and loving toward you 1=SA, 2=Agree, 3=Neither A or D, 4=Disagree, 5=SD, 97=legit skip,98=dk, 99=not appl Thanks for your help! -Eric No virus found in this message. |
Wouldn't it be better to leave the missing
value definition intact and use the MISSING function?
Jon Peck Senior Software Engineer, IBM [hidden email] 312-651-3435 From: Hector Maletta <[hidden email]> To: [hidden email] Date: 04/18/2011 09:19 PM Subject: Re: [SPSSX-L] help: compute a new variable, by using the responses of two variables Sent by: "SPSSX(r) Discussion" <[hidden email]> Simple syntax: Missing values H3WP19 (). IF (H3WP19=96 or if H3WP19=97 or if H3WP19=99) H3WP19=H3WP31. I include the MISSING VALUES command to cancel any user-declared missing values, just in case you had declared the values 96, 97 and 99 as missing. In that case, The IF command would not work in cases with those values if they are missing, because cases with missing values are ignored in IF commands as the above. After applying the above syntax you can define again your missing values for H3WP19. Hector De: SPSSX(r) Discussion [[hidden email]] En nombre de Buhi, Eric Enviado el: Monday, April 18, 2011 23:16 Para: [hidden email] Asunto: help: compute a new variable, by using the responses of two variables Good evening all. I am trying to compute a new variable, by using the responses of two variables. Specifically, I would like to create WarmMom, such that if H3WP19 is not answered (e.g., 96, 97, 99), then it will substitute, or use the value for H3WP31 (below). Does anyone know what syntax commands I'd use? H3WP19 Most of the time {residential mom} is warm and loving toward you 1=SA, 2=Agree, 3=Neither A or D, 4=Disagree, 5=SD, 96=refused, 97=legit skip,99=not appl H3WP31 Most of the time {mom you used to live with} is warm and loving toward you 1=SA, 2=Agree, 3=Neither A or D, 4=Disagree, 5=SD, 97=legit skip,98=dk, 99=not appl Thanks for your help! -Eric No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1321 / Virus Database: 1500/3582 - Release Date: 04/18/11 |
Jon, Of course, but the expression would become more complicated. I wanted to keep it as simple as possible. Hector De: Jon K Peck [mailto:[hidden email]] Wouldn't it be better to leave the missing value definition intact and use the MISSING function?
No virus found in this message. |
In reply to this post by Buhi, Eric
How about something like (untested): Do if (missing (H3WP19 )) . Compute warmmom = H3WP31 . Else if (missing (H3WP31 )) . Compute warmmom = H3WP19 . End if . Missing values warmmom (96, 97, 99) . John Hall From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Buhi, Eric Good evening all. I am trying to compute a new variable, by using the responses of two variables. Specifically, I would like to create WarmMom, such that if H3WP19 is not answered (e.g., 96, 97, 99), then it will substitute, or use the value for H3WP31 (below). Does anyone know what syntax commands I'd use? H3WP19 Most of the time {residential mom} is warm and loving toward you 1=SA, 2=Agree, 3=Neither A or D, 4=Disagree, 5=SD, 96=refused, 97=legit skip,99=not appl H3WP31 Most of the time {mom you used to live with} is warm and loving toward you 1=SA, 2=Agree, 3=Neither A or D, 4=Disagree, 5=SD, 97=legit skip,98=dk, 99=not appl Thanks for your help! -Eric |
Administrator
|
In reply to this post by Hector Maletta
If the only missing values are 96, 97 and 99, then using MISSING(), as Jon suggests, is simpler, I think.
IF missing(H3WP19) H3WP19=H3WP31. For Hector's method, I would use ANY rather than multiple OR's. Missing values H3WP19 (). IF any(H3WP19,96,97,99) H3WP19=H3WP31. HTH.
--
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/). |
<soap box> I like to have the ELSE section only for detecting flaws in my logic. <\soap box> Missing values H3WP19 H3WP31 (). *19 ok 31 ok. *19 ok 31 missing DO if H3WP19 le 5. compute warmmom = H3WP19. * 19 missing 31 ok. ELSE If H3WP19 ge 6 and H3WP3 le 5. *Both missing. ELSE If H3WP19 ge 6 and H3WP31 ge 6. compute warmmom = 98. *should never get here. ELSE. compute warmmom = 999. end if. Missing values H3WP19 H3WP31 warmmom (6 thru hi). value labels H3WP19 H3WP31 warmmom 999 'SPLAT!! logically impossible' 98 'Both missing' 99 '.... Art Kendall Social Research Consultants <snip> ===================== 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 Bruce Weaver
He wants the new variable to be called warmmom so he needs:
COMPUTE WARMMOM = H3WP19 . IF missing(H3WP19) WARMMOM=H3WP31. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver Sent: 19 April 2011 13:26 To: [hidden email] Subject: Re: help: compute a new variable, by using the responses of two variables If the only missing values are 96, 97 and 99, then using MISSING(), as Jon suggests, is simpler, I think. IF missing(H3WP19) H3WP19=H3WP31. For Hector's method, I would use ANY rather than multiple OR's. Missing values H3WP19 (). IF any(H3WP19,96,97,99) H3WP19=H3WP31. HTH. Hector Maletta wrote: > > Jon, > > Of course, but the expression would become more complicated. I wanted to > keep it as simple as possible. > > Hector > > > > De: Jon K Peck [mailto:[hidden email]] > Enviado el: Tuesday, April 19, 2011 00:35 > Para: Hector Maletta > CC: [hidden email] > Asunto: Re: [SPSSX-L] help: compute a new variable, by using the responses > of two variables > > > > Wouldn't it be better to leave the missing value definition intact and use > the MISSING function? > > Jon Peck > Senior Software Engineer, IBM > [hidden email] > 312-651-3435 > > > > From: Hector Maletta <[hidden email]> > To: [hidden email] > Date: 04/18/2011 09:19 PM > Subject: Re: [SPSSX-L] help: compute a new variable, > by > using the responses of two variables > Sent by: "SPSSX(r) Discussion" <[hidden email]> > > _____ > > > > > Simple syntax: > Missing values H3WP19 (). > IF (H3WP19=96 or if H3WP19=97 or if H3WP19=99) H3WP19=H3WP31. > > I include the MISSING VALUES command to cancel any user-declared missing > values, just in case you had declared the values 96, 97 and 99 as missing. > In that case, The IF command would not work in cases with those values if > they are missing, because cases with missing values are ignored in IF > commands as the above. > After applying the above syntax you can define again your missing values > for > H3WP19. > > Hector > > De: SPSSX(r) Discussion [ <mailto:[hidden email]> > mailto:[hidden email]] En nombre de Buhi, Eric > Enviado el: Monday, April 18, 2011 23:16 > Para: [hidden email] > Asunto: help: compute a new variable, by using the responses of two > variables > > Good evening all. > > I am trying to compute a new variable, by using the responses of two > variables. Specifically, I would like to create WarmMom, such that if > H3WP19 > is not answered (e.g., 96, 97, 99), then it will substitute, or use the > value for H3WP31 (below). > > Does anyone know what syntax commands I'd use? > > H3WP19 Most of the time {residential mom} is warm and loving toward > you 1=SA, 2=Agree, 3=Neither A or D, 4=Disagree, 5=SD, 96=refused, > 97=legit skip,99=not appl > > H3WP31 Most of the time {mom you used to live with} is warm and > loving toward you 1=SA, 2=Agree, 3=Neither A or D, 4=Disagree, > 5=SD, > 97=legit skip,98=dk, 99=not appl > > Thanks for your help! > > -Eric > > > > _____ > > > No virus found in this message. > Checked by AVG - www.avg.com <http://www.avg.com/> > Version: 10.0.1321 / Virus Database: 1500/3582 - Release Date: 04/18/11 > > _____ > > No virus found in this message. > Checked by AVG - www.avg.com > Version: 10.0.1321 / Virus Database: 1500/3582 - Release Date: 04/18/11 > ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/help-compute-a-new-variable-by -using-the-responses-of-two-variables-tp4312268p4313025.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 |
Free forum by Nabble | Edit this page |