Hello everyone,
It's my first time posting so apologies in advance if I mess something up! I've spent the last few days searching the archives and Google but have yet to find a solution for my particular problem. I have two survey questions that assess what respondents view as the Most Important facet in a particular issue (Q1) and the Second Most Important facet for the same issue (Q2). Both questions use the same six answer choices, with the exception being that the answer chosen in Q1 is omitted from Q2. The survey is programmed so that an answer of #1 for Q1 will skip to Q2a, and so on for all 6 choices to Q1. The variable Q2a omits #1 as an answer, Q2b omits #2, and so on. I need to combine the Q2 a,b,c,d,e,f variables into one full variable. What I have so far looks something like this: compute fullvar = 0. if (q1 eq 1 and q2a eq 2) fullvar = 2. if (q1 eq 1 and q2a eq 3) fullvar = 3. if (q1 eq 1 and q2a eq 4) fullvar = 4. if (q1 eq 1 and q2a eq 5) fullvar = 5. if (q1 eq 1 and q2a eq 6) fullvar = 6. if (q1 eq 1 and q2a eq 8) fullvar = 8. if (q1 eq 1 and q2a eq 9) fullvar = 9. if (q1 eq 2 and q2b eq 1) fullvar = 1. if (q1 eq 2 and q2b eq 3) fullvar = 3. if (q1 eq 2 and q2b eq 4) fullvar = 4. if (q1 eq 2 and q2b eq 5) fullvar = 5. if (q1 eq 2 and q2b eq 6) fullvar = 6. if (q1 eq 2 and q2b eq 8) fullvar = 8. if (q1 eq 2 and q2b eq 9) fullvar = 9. ...(this continues for all 6 choices to Q1)... Basically I was wondering if I was on the right track here and/or if there a more elegant way of doing this (DO IF perhaps?). Thanks, Alfonso |
Administrator
|
Would COMPUTE fullvar=MAX(q2a,q2b,q3c.....) suffice?
If not then you are providing incomplete information!
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 Alfonso Romero
If you define the VECTOR for the values q2A through q2F (?) you can then just reference the location of the q2 vector with the value of q1. Easier to show than to say, example below:
***************************************. *Fake data. DATA LIST LIST (",") /q1 q2A q2B q2C q2D q2E q2F. BEGIN DATA 1,2 2,,3 3,,,4 4,,,,5 END DATA. *This is what I think you want to do. VECTOR q2 = q2A to q2F. COMPUTE fullvar = q2(q1). EXECUTE. ***************************************. |
In reply to this post by David Marso
Yes that is probably simpler than my advice, depends on how missing data is stored for the other fields though, but the logic is the same for MAX or MIN.
|
In reply to this post by David Marso
That worked perfectly. Thanks very much for the help.
|
Free forum by Nabble | Edit this page |