Hello,
I am trying to calculate the number of clients who are upto date (defined as had 4 doses of vaccine if they had their 4th dose after 1,460 days or 5 or more doses of vaccine if the 4th dose was before or on 1,460 days. Here is the sample data used. Any help will be greatly appreciated. Thanks ID days number_dose 1033 68 1 1033 123 1 1033 185 1 1033 787 1 1033 1531 1 1034 188 1 1034 362 1 1034 523 1 1034 1147 1 1034 2015 1 1035 69 1 1035 133 1 1035 206 1 1035 605 1 1036 113 1 1036 207 1 1036 1549 1 1036 2207 1 1037 67 1 1037 123 1 1037 207 1 1037 555 1 1037 1464 1 1038 62 1 1038 118 1 1038 189 1 1038 617 1 1038 1944 1 ===================== 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 |
So it looks like the number_dose variable is irrelevant to your problem. Assume the file is sorted by id and days.
if ($casenum eq 1 or id ne lag(id)) rec=1. If (id eq lag(id)) rec=lag(rec)+1. Aggregate outfile=* mode=addvariables/break=id/tot=nu. Compute uptodate=0. Do if (rec eq 4). If (tot eq 4 and days gt 1460) uptodate=1. If (tot gt 4 and days le 1460) uptodate=1. End if. Aggregate outfile=*/break=id/uptodate=max(uptodate). I calculate all ids except for 1035 are 'uptodate'. True? Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of George Zaman Sent: Monday, March 11, 2013 6:39 PM To: [hidden email] Subject: Number of doses Hello, I am trying to calculate the number of clients who are upto date (defined as had 4 doses of vaccine if they had their 4th dose after 1,460 days or 5 or more doses of vaccine if the 4th dose was before or on 1,460 days. Here is the sample data used. Any help will be greatly appreciated. Thanks ID days number_dose 1033 68 1 1033 123 1 1033 185 1 1033 787 1 1033 1531 1 1034 188 1 1034 362 1 1034 523 1 1034 1147 1 1034 2015 1 1035 69 1 1035 133 1 1035 206 1 1035 605 1 1036 113 1 1036 207 1 1036 1549 1 1036 2207 1 1037 67 1 1037 123 1 1037 207 1 1037 555 1 1037 1464 1 1038 62 1 1038 118 1 1038 189 1 1038 617 1 1038 1944 1 ===================== 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 |
Why note RECODE into different variable, for example "Up2Date"
Select if dose > or = 4 and Days > or = 1460 Regards, Joseph A. Youngblood Director of Research -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Maguin, Eugene Sent: Monday, March 11, 2013 6:59 PM To: [hidden email] Subject: Re: Number of doses So it looks like the number_dose variable is irrelevant to your problem. Assume the file is sorted by id and days. if ($casenum eq 1 or id ne lag(id)) rec=1. If (id eq lag(id)) rec=lag(rec)+1. Aggregate outfile=* mode=addvariables/break=id/tot=nu. Compute uptodate=0. Do if (rec eq 4). If (tot eq 4 and days gt 1460) uptodate=1. If (tot gt 4 and days le 1460) uptodate=1. End if. Aggregate outfile=*/break=id/uptodate=max(uptodate). I calculate all ids except for 1035 are 'uptodate'. True? Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of George Zaman Sent: Monday, March 11, 2013 6:39 PM To: [hidden email] Subject: Number of doses Hello, I am trying to calculate the number of clients who are upto date (defined as had 4 doses of vaccine if they had their 4th dose after 1,460 days or 5 or more doses of vaccine if the 4th dose was before or on 1,460 days. Here is the sample data used. Any help will be greatly appreciated. Thanks ID days number_dose 1033 68 1 1033 123 1 1033 185 1 1033 787 1 1033 1531 1 1034 188 1 1034 362 1 1034 523 1 1034 1147 1 1034 2015 1 1035 69 1 1035 133 1 1035 206 1 1035 605 1 1036 113 1 1036 207 1 1036 1549 1 1036 2207 1 1037 67 1 1037 123 1 1037 207 1 1037 555 1 1037 1464 1 1038 62 1 1038 118 1 1038 189 1 1038 617 1 1038 1944 1 ===================== 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 ===================== 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 |
I don't understand your message because I can't locate where the recode would go and what would be recoded. The same is true for the Select line. If I assume that the Select statement would replace the Do if block then dose would have already been computed. So, I'd say two considerations to choose Do if instead of Select. First, George identified two conditions that were to be scored as up to date. Second, I assumed (because I'd want this) that he'd want to know which cases were up to date and which were not.
Gene Maguin -----Original Message----- From: Joseph A. Youngblood [mailto:[hidden email]] Sent: Monday, March 11, 2013 10:18 PM To: Maguin, Eugene; [hidden email] Subject: RE: Number of doses Why note RECODE into different variable, for example "Up2Date" Select if dose > or = 4 and Days > or = 1460 Regards, Joseph A. Youngblood Director of Research -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Maguin, Eugene Sent: Monday, March 11, 2013 6:59 PM To: [hidden email] Subject: Re: Number of doses So it looks like the number_dose variable is irrelevant to your problem. Assume the file is sorted by id and days. if ($casenum eq 1 or id ne lag(id)) rec=1. If (id eq lag(id)) rec=lag(rec)+1. Aggregate outfile=* mode=addvariables/break=id/tot=nu. Compute uptodate=0. Do if (rec eq 4). If (tot eq 4 and days gt 1460) uptodate=1. If (tot gt 4 and days le 1460) uptodate=1. End if. Aggregate outfile=*/break=id/uptodate=max(uptodate). I calculate all ids except for 1035 are 'uptodate'. True? Gene Maguin -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of George Zaman Sent: Monday, March 11, 2013 6:39 PM To: [hidden email] Subject: Number of doses Hello, I am trying to calculate the number of clients who are upto date (defined as had 4 doses of vaccine if they had their 4th dose after 1,460 days or 5 or more doses of vaccine if the 4th dose was before or on 1,460 days. Here is the sample data used. Any help will be greatly appreciated. Thanks ID days number_dose 1033 68 1 1033 123 1 1033 185 1 1033 787 1 1033 1531 1 1034 188 1 1034 362 1 1034 523 1 1034 1147 1 1034 2015 1 1035 69 1 1035 133 1 1035 206 1 1035 605 1 1036 113 1 1036 207 1 1036 1549 1 1036 2207 1 1037 67 1 1037 123 1 1037 207 1 1037 555 1 1037 1464 1 1038 62 1 1038 118 1 1038 189 1 1038 617 1 1038 1944 1 ===================== 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 ===================== 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 George Zaman
Thank you Gene for your help!!
===================== 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 |