|
All,
I'm having trouble calculating a date difference from my data set and any help would be greatly appreciated. I apologize if this is a simple question but I can't seem to make it work. I'm working with a data set in which individuals were administered 3 different measures at various time points. I'm able to use the date and time wizard to calculate the time difference between measures. Now I need to create sets for each individual and compare the time difference between sets. In order to do this I need to calculate time differences within a single variable. For example: ID Measure 1 1 2007 1 2008 1 2010 2 2006 2 2012 3 2008 3 2009 Is there a way to do this without going through each participant as this would take quite some time (I'm working with days, months, years)? For some participants I have more than just two time points for when the measure was administered but I can filter these out to have only two scores each per measure if necessary. Thanks so much! V/R Justin |
|
Administrator
|
Take a look at the LAG function also CREATE and SHIFT VALUES commands.
Other useful commands SPLIT FILE and DO IF. Review try some stuff and repost any remaining issues.
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?" |
|
In reply to this post by Justin Blehar
I don't find it obvious what it is that you are trying to obtain.
But I think that the first step might be -- Use Lag to get the time difference between records, and set it to missing if the Lag on ID does not show a match. That gets you one or more times for a person. You can use Aggregate to get one record per person, which can contain the average or the total -- if that is what you are looking for. If you want something else, please try again. -- Rich Ulrich Date: Thu, 17 Jan 2013 06:40:28 +0000 From: [hidden email] Subject: Calculating Dates from a single variable To: [hidden email] All, I'm having trouble calculating a date difference from my data set and any help would be greatly appreciated. I apologize if this is a simple question but I can't seem to make it work. I'm working with a data set in which individuals were administered 3 different measures at various time points. I'm able to use the date and time wizard to calculate the time difference between measures. Now I need to create sets for each individual and compare the time difference between sets. In order to do this I need to calculate time differences within a single variable. For example: ID Measure 1 1 2007 1 2008 1 2010 2 2006 2 2012 3 2008 3 2009 Is there a way to do this without going through each participant as this would take quite some time (I'm working with days, months, years)? For some participants I have more than just two time points for when the measure was administered but I can filter these out to have only two scores each per measure if necessary. Thanks so much! ... |
|
Administrator
|
IOW: If you really expect any sort of solution you would best take a few minutes and cobble out an AFTER version of what the data should look like! Yeah, there are a number of gifted telepaths in this group but ...
--
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 |
