|
Dear all,
Happy New year! I need to replace missing of job of four waves (1997,2000,2004,2006) with value from previous waves (1993, 1991,1989). Preference is given to the value from more recent waves. I wrote the syntax as following but it seems not working. just wonder anyone can correct it for me? DO IF (SYSMIS(JOB_1997) & SYSMIS(JOB_2000) & SYSMIS (JOB_2004) & SYSMIS(JOB_2006) ). COMP JOB=JOB_1993. ELSE IF (SYSMIS (JOB_1993)). COMP JOB=JOB_1991. ELSE IF (SYSMIS (JOB_1991)). COMP JOB=JOB_1989. END IF. EXE. Thanks Yawen ===================== 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 |
|
Yawen,
I think you have two levels of problems. The immediate level of problem is that, as I understand the dataset implied by your syntax, you do not have a variable in the 1997, 2000, 2004, 2006 called 'job'. The variable is called JOB_1997, JOB_2000, JOB_2004, JOB_2006, depending on the year. So, 'job' has to be replaced by one of these four variables. But this then leads to the deeper problem level, which is that the conceptualization of the problem as expressed in your syntax does not match your description. Based on your description, you wish the syntax to operate as follows. If, for example, job_1997 is sysmis, you want to replace sysmis with the job_1993 value, if job_1993 is missing, you want to use job_1991, etc. Having fixed up job_1997 for that case you then check job_2000. So i think this will work (but bear in mind that it is untested and may have problems, which I will fix if you repost with the problem). Do repeat x=job_1997 job_2000 job_2004 job_2006. Do if (sysmis(x)). + do if (not(sysmis(job_1993))). + compute x=job_1993. + else if (not(sysmis(job_1991))). + compute x=job_1991. + else if (not(sysmis(job_1989))). + compute x=job_1989. + end if. End if. End repeat. By the way, something that I hope you have thought of is that if job_1997 job_2000 job_2004 job_2006 are all missing, your replacement strategy will give all of them the same value. Gene Maguin >>I need to replace missing of job of four waves (1997,2000,2004,2006) with value from previous waves (1993, 1991,1989). Preference is given to the value from more recent waves. I wrote the syntax as following but it seems not working. just wonder anyone can correct it for me? DO IF (SYSMIS(JOB_1997) & SYSMIS(JOB_2000) & SYSMIS (JOB_2004) & SYSMIS(JOB_2006) ). COMP JOB=JOB_1993. ELSE IF (SYSMIS (JOB_1993)). COMP JOB=JOB_1991. ELSE IF (SYSMIS (JOB_1991)). COMP JOB=JOB_1989. END IF. EXE. ===================== 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 |
