All, This syntax appears to be working but I want to be sure it
is doing what I think it’s doing. I’m using do repeat to calculate a value and then
using that calculated value within the do repeat syntax. This is where I get
mixed up about the rules of ‘execute’. I would think you’d
have to execute the one statement first before the next statement would have
anything to work with, but I’m not sure if that isn’t what is
happening already within the do repeat statement. Is what I’m doing
kosher? Prior to this syntax all of the variables that are listed
after my stand-in variables exist and are in the proper order. Like I said, it
runs fine. Here’s my syntax do repeat elig_group = nov_2010_elig_group to
dec_2011_elig_group /fpl = nov_2010_fpl to dec_2011_fpl /claimable = claimable_nov_2010 to
claimable_dec_2011 /mce_hcci = mce_hcci_nov_2010 to
mce_hcci_dec_2011.
*
THE FOLLOWING COMPUTE STATEMENT CREATES A VARIABLE THAT IS THEN USED BY THE
NEXT ‘IF’, AND ‘DO-IF’ STATEMENTS. compute claimable =
any(ltrim(rtrim(elig_group)), '003', '004', '005', '007', '008', '010',
'011','013', '014'). if (claimable_elig_group = 1) &
(sysmis(fpl) = 1) fpl = 0. do if (any(ltrim(rtrim(elig_group)),
'003', '004', '005', '007', '008')). if (claimable = 1)
& (fpl <=133) mce_hcci = 1. if (claimable = 1)
& (fpl >133) mce_hcci = 2. if (claimable =
0) mce_hcci = 3. else if
(any(ltrim(rtrim(elig_group)), '010', '011')). compute mce_hcci =
1. else if
(any(ltrim(rtrim(elig_group)), '013', '014')). compute mce_hcci =
2. end if. end repeat. exe. Thanks! Matt Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 568-5648 |
I will be out of the office December 17th through Jan 2nd. I will be returning the morning of Jan 3rd. I will not have access to email or voicemail. I will respond to your message when I return. If you need immediate assistance, please contact Ross Wohlert at 860-676-3677.
CONFIDENTIALITY NOTICE: This communication contains information intended for the use of the individuals to whom it is addressed and may contain information that is privileged, confidential or exempt from other disclosure under applicable law. If you are not the intended recipient, you are notified that any disclosure, printing, copying, distribution or use of the contents is prohibited. If you have received this in error, please notify the sender immediately by telephone or by returning it by return mail and then permanently delete the communication from your system. Thank you. ===================== 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 mpirritano
No Execute statements are necessary. The
transformation language is designed to be very efficient in that regard.
Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] Phone: 312.893.4922 | T/L: 206-4922 From: "Pirritano, Matthew" <[hidden email]> To: [hidden email] Date: 12/16/2011 04:21 PM Subject: use value computed in 'do repeat' within 'do repeat' Sent by: "SPSSX(r) Discussion" <[hidden email]> All, This syntax appears to be working but I want to be sure it is doing what I think it’s doing. I’m using do repeat to calculate a value and then using that calculated value within the do repeat syntax. This is where I get mixed up about the rules of ‘execute’. I would think you’d have to execute the one statement first before the next statement would have anything to work with, but I’m not sure if that isn’t what is happening already within the do repeat statement. Is what I’m doing kosher? Prior to this syntax all of the variables that are listed after my stand-in variables exist and are in the proper order. Like I said, it runs fine. Here’s my syntax do repeat elig_group = nov_2010_elig_group to dec_2011_elig_group /fpl = nov_2010_fpl to dec_2011_fpl /claimable = claimable_nov_2010 to claimable_dec_2011 /mce_hcci = mce_hcci_nov_2010 to mce_hcci_dec_2011. * THE FOLLOWING COMPUTE STATEMENT CREATES A VARIABLE THAT IS THEN USED BY THE NEXT ‘IF’, AND ‘DO-IF’ STATEMENTS. compute claimable = any(ltrim(rtrim(elig_group)), '003', '004', '005', '007', '008', '010', '011','013', '014'). if (claimable_elig_group = 1) & (sysmis(fpl) = 1) fpl = 0. do if (any(ltrim(rtrim(elig_group)), '003', '004', '005', '007', '008')). if (claimable = 1) & (fpl <=133) mce_hcci = 1. if (claimable = 1) & (fpl >133) mce_hcci = 2. if (claimable = 0) mce_hcci = 3. else if (any(ltrim(rtrim(elig_group)), '010', '011')). compute mce_hcci = 1. else if (any(ltrim(rtrim(elig_group)), '013', '014')). compute mce_hcci = 2. end if. end repeat. exe. Thanks! Matt Matthew Pirritano, Ph.D. Research Analyst IV Medical Services Initiative (MSI) Orange County Health Care Agency (714) 568-5648 |
Administrator
|
In reply to this post by mpirritano
EXECUTE is rarely required!
Only situations are SELECT based on $CASENUM and variables computed from LAG. Sometimes not even NECESSARY then, but good in these cases to cover your butt in case you are uncertain.
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
|
I would likely rewrite your syntax as follows:
DO REPEAT elig_group = nov_2010_elig_group TO dec_2011_elig_group /fpl = nov_2010_fpl TO dec_2011_fpl /claimable = claimable_nov_2010 TO claimable_dec_2011 /mce_hcci = mce_hcci_nov_2010 TO mce_hcci_dec_2011. + COMPUTE elig_group=LTRIM(elig_group). + RECODE elig_group ('010', '011'=1)('013','014'=2)('003', '004', '005', '007', '008'=3) INTO claimable . + IF (claimable_elig_group = 1) & sysmis(fpl) fpl = 0. + COMPUTE mce_hcci = (claimable EQ 1)|((claimable EQ 3) & (fpl LE 133)) + ((claimable EQ 2)|((claimable EQ 3) & (fpl GT 133)))*2. + RECODE claimable(1,2,3=1). END REPEAT.
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
|
The following is even simpler still:
DO REPEAT elig_group = nov_2010_elig_group TO dec_2011_elig_group /fpl = nov_2010_fpl TO dec_2011_fpl /claimable = claimable_nov_2010 TO claimable_dec_2011 /mce_hcci = mce_hcci_nov_2010 TO mce_hcci_dec_2011. + COMPUTE elig_group=LTRIM(elig_group). + RECODE elig_group ('010', '011'=1)('013','014'=2)('003', '004', '005', '007', '008'=3) INTO claimable . + IF (claimable_elig_group = 1) & sysmis(fpl) fpl = 0. + COMPUTE mce_hcci = claimable -(claimable EQ 3) * ((fpl LE 133)+1). + RECODE claimable(1,2,3=1). END REPEAT.
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 |