Dear All, This seems simple, but I just could not get the ‘correct solution.’ I need to select (ONLY) the first 6 months following enrollment for my analysis. Most of the participants would stay 10 months or longer in the program. So, for example,
for participant 502 I only need 6/1/2011 thru 11/1/2011 data. Thank you all. Shirley
|
AGGREGATE
/OUTFILE=* MODE=ADDVARIABLES /BREAK=ParticipantID /Q4A01_Reporting_Period_first=FIRST(Q4A01_Reporting_Period). COMPUTE timesince=DATEDIFF(Q4A01_Reporting_Period,Q4A01_Reporting_Period_first,"months"). SELECT IF timesince <=6. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Shirley Scholtz <[hidden email]> To: [hidden email], Date: 11/12/2013 12:34 PM Subject: [SPSSX-L] select cases Sent by: "SPSSX(r) Discussion" <[hidden email]> Dear All, This seems simple, but I just could not get the ‘correct solution.’ I need to select (ONLY) the first 6 months following enrollment for my analysis. Most of the participants would stay 10 months or longer in the program. So, for example, for participant 502 I only need 6/1/2011 thru 11/1/2011 data. Thank you all. Shirley
|
Administrator
|
You can also flag the first record of an ID using MATCH FILES.
Then use the properties of #scratch variables to 'drag' the value. MATCH FILES FILE * / BY ParticipantID / FIRST=@TOP@. IF @TOP@ #D=Q4A01_Reporting_Period . SELECT IF DATEDIFF(Q4A01_Reporting_Period,#D,"months") LE 6.
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?" |
Thanks Jon and David for your help.
Shirley -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Marso Sent: Tuesday, November 12, 2013 4:30 PM To: [hidden email] Subject: Re: select cases You can also flag the first record of an ID using MATCH FILES. Then use the properties of #scratch variables to 'drag' the value. MATCH FILES FILE * / BY ParticipantID / FIRST=@TOP@. IF @TOP@ #D=Q4A01_Reporting_Period . SELECT IF DATEDIFF(Q4A01_Reporting_Period,#D,"months") LE 6. Jon K Peck wrote > AGGREGATE > /OUTFILE=* MODE=ADDVARIABLES > /BREAK=ParticipantID > /Q4A01_Reporting_Period_first=FIRST(Q4A01_Reporting_Period). > COMPUTE > timesince=DATEDIFF(Q4A01_Reporting_Period,Q4A01_Reporting_Period_first,"months"). > SELECT IF timesince <=6. > > > Jon Peck (no "h") aka Kim > Senior Software Engineer, IBM > peck@.ibm > phone: 720-342-5621 > > > > > From: Shirley Scholtz < > Scholtz@ > > > To: > SPSSX-L@.uga > , > Date: 11/12/2013 12:34 PM > Subject: [SPSSX-L] select cases > Sent by: "SPSSX(r) Discussion" < > SPSSX-L@.uga > > > > > > Dear All, > This seems simple, but I just could not get the ‘correct solution.’ I > need to select (ONLY) the first 6 months following enrollment for my analysis. > Most of the participants would stay 10 months or longer in the program. > So, for example, for participant 502 I only need 6/1/2011 thru > 11/1/2011 data. Thank you all. Shirley > > > ParticipantID > Q4A01_Reporting_Period > ReasonCloseRev2 > > > > 502 > 6/1/2011 > 1 > 502 > 7/1/2011 > 1 > 502 > 8/1/2011 > 1 > 502 > 9/1/2011 > 1 > 502 > 10/1/2011 > 1 > 502 > 11/1/2011 > 1 > 502 > 12/1/2011 > 1 > 502 > 1/1/2012 > 1 > 502 > 2/1/2012 > 1 > 502 > 3/1/2012 > 1 > 502 > 4/1/2012 > 1 > 504 > 6/1/2011 > 1 > 504 > 7/1/2011 > 1 > 504 > 8/1/2011 > 1 > 504 > 9/1/2011 > 1 > 504 > 10/1/2011 > 1 > 504 > 11/1/2011 > 1 > 504 > 12/1/2011 > 1 > 504 > 1/1/2012 > 1 ----- 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?" -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/select-cases-tp5723008p5723011.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== 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 |
Free forum by Nabble | Edit this page |