Hello SPSS listers… Maybe it’s just way too late on a Friday (and the last Friday of the Olympics (i.e. staying up late to watch them), but I am having a problem, and I am sure there is a better way to fix it. I want system missing values to be passed on to the next else if. With over 30,000 records—when I get to this portion of the syntax, there are 12 cases that would be calculated if the system missing values were passed to the next else if. Is there a simple way to do this (short of recoding the sysmis to 0)? This is a multistep procedure that has multiple similar steps—compute primsev2 based on X, if it is still missing, compute it based on Y--etc. While it probably has a programmability solution, I would like a regular syntax solution.
** if days are all 0, but sev exists, use severity in order. do if missing(primsev2) and mdys=0 and msev=1.
do if amsev=maxsev. compute primsev2=2. else if opsev eq maxsev. compute primsev2=5. else if ccsev eq maxsev. compute primsev2=4. else if alsev eq maxsev. compute primsev2=1. else if mjsev eq maxsev. compute primsev2=3. else if od5sev eq maxsev. compute primsev2=6. end if. end if. It does seem like overkill, but does work to separate each section into its own do if statement, And yes—I don’t like the multiple ‘exe’s either, but this does not work correctly without them. do if missing(primsev2) and mdys=0 and msev=1 and amsev=maxsev. compute primsev2=2. end if. exe. do if missing(primsev2) and mdys=0 and msev=1 and opsev eq maxsev. compute primsev2=5. end if. exe. do if missing(primsev2) and mdys=0 and msev=1 and ccsev eq maxsev. compute primsev2=4. end if. exe. do if missing(primsev2) and mdys=0 and msev=1 and alsev eq maxsev. compute primsev2=1. end if. exe. do if missing(primsev2) and mdys=0 and msev=1 and mjsev eq maxsev. compute primsev2=3. end if. exe. do if missing(primsev2) and mdys=0 and msev=1 and od5sev eq maxsev. compute primsev2=6. end if. Melissa Ives [hidden email]
"The difference between the almost right word and the right word is really a large matter
-- 'tis the difference between the lightning bug and the lightning." -- Mark Twain <>< <>< PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. |
I am out of the office until Monday August 13. For immediate assistance please contact Fran Lucero ([hidden email]). Thank you. |
In reply to this post by Melissa Ives
Hi
I am not in the office right now - I will be back Monday August 20th and respond to your mail Best regards Søren |
In reply to this post by Melissa Ives
I am PTOB today, Friday 10 August. For assistance with
the MITRE Innovation Program please contact the [hidden email] For assistance with Project/Portfolio Pages or Discover, please contact the
[hidden email] For assistance with
other Innovation Zone sites, such as CI&T InZone, please contact [hidden email]. Regards, Mary Lou |
In reply to this post by Melissa Ives
Thank you for your email.
I am on vacation until Tuesday August 14 and will not be accessing my emails. I will respond to your message upon my return to the office on Wednesday August 15. Have a wonderful day. Valerie Villella Education Coordinator & Policy and Program Analyst ===================== 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 Melissa Ives
At 06:59 PM 8/10/2012, Melissa Ives wrote:
>This is a multistep procedure that has multiple >similar stepscompute primsev2 based on X, if it >is still missing, compute it based on Y--etc. >While it probably has a programmability >solution, I would like a regular syntax solution. > >** if days are all 0, but sev exists, use severity in order. >do if missing(primsev2) and mdys=0 and msev=1. > do if amsev=maxsev. > compute primsev2=2. > else if opsev eq maxsev. > compute primsev2=5. > else if ccsev eq maxsev. > compute primsev2=4. > else if alsev eq maxsev. > compute primsev2=1. > else if mjsev eq maxsev. > compute primsev2=3. > else if od5sev eq maxsev. > compute primsev2=6. > end if. >end if. I suppose that, before this, "maxsev" is set to MAX (amsev,opsev,ccssev, alsev, mjsev, od5sev) Then, this should work *except* that if any of the severities is missing, but that one's clause is reached, the whole DO IF will be skipped. For example, if "amsev" is missing, "primsev2" won't be set; if "amsev" is less than "maxsev", and then "opsev" is missing, "primsev2" won't be set; etc. Assuming that "maxsev" is never missing, it should work if you force all 'missing' tests to evaluate as 'false': do if missing(primsev2) and mdys=0 and msev=1. do if NOT MISSING(amsev) AND amsev=maxsev. compute primsev2=2. else if NOT MISSING(opsev) AND opsev eq maxsev. compute primsev2=5. else if NOT MISSING(ccsev) AND ccsev eq maxsev. compute primsev2=4. else if NOT MISSING(alsev) AND alsev eq maxsev. compute primsev2=1. else if NOT MISSING(mjsev) AND mjsev eq maxsev. compute primsev2=3. else if NOT MISSING(od5sev) AND od5sev eq maxsev. compute primsev2=6. end if. end if. I admit the logic looks strange. The point of the NOT MISSING tests is that if the test variable (e.g., "amsev") is missing, it evaluates 'false'; the whole test evaluates as "'false' AND 'missing'"; and that's 'false'. >It does work to separate each section into its own do if statement, > >do if missing(primsev2) and mdys=0 and msev=1 and amsev=maxsev. > compute primsev2=2. >end if. >exe. >do if missing(primsev2) and mdys=0 and msev=1 and opsev eq maxsev. > compute primsev2=5. >end if. >exe. >do if missing(primsev2) and mdys=0 and msev=1 and ccsev eq maxsev. > compute primsev2=4. >end if. >exe. >do if missing(primsev2) and mdys=0 and msev=1 and alsev eq maxsev. > compute primsev2=1. >end if. >exe. >do if missing(primsev2) and mdys=0 and msev=1 and mjsev eq maxsev. > compute primsev2=3. >end if. >exe. >do if missing(primsev2) and mdys=0 and msev=1 and od5sev eq maxsev. > compute primsev2=6. >end if. That should work, because now each "do if" is not governed by any preceding test. But it should work without the EXECUTE statements; I've no idea why it wouldn't. ===================== 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 Melissa Ives
How about at it going lean and mean...
DO IF MISSING(primsev2) AND mdys=0 AND msev=1. + DO REPEAT sev=amsev opsev ccsev alsev mjsev od5sev / val=2 5 4 1 3 6. + IF (MISSING(primsev2) AND sev=maxsev) primsev2=val. END IF. -----------------------------
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?" |
Administrator
|
Ooops, was missing the END REPEAT ;-( corrected in quoted post
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?" |
Free forum by Nabble | Edit this page |