Calculating with dates for selected cases

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

crsia
Posts: 3
Joined: Mon Apr 14, 2014 3:10 pm

Calculating with dates for selected cases

Postby crsia » Tue Apr 22, 2014 1:40 pm

Hi,
I am wanting to calculate the number of years between two dates, but only for certain cases. If I use the date and time wizard and use the “calculate the number of time units between two dates” option, it works fine but it will just calculate for everyone, I can’t select the cases I want.
And if I use the Transform - “Compute Variable” option, I can select only the cases I want, but I do not know what expression I need for what I want to do. If I try to calculate the time by subtracting one date from the other as I would do in the date time wizard, I get an answer like 26.10.2012-14.07.1989 = 26.01.1606, rather than 23.3 years.
Thank you for any help! :)
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: Calculating with dates for selected cases

Postby GerineL » Tue Apr 22, 2014 3:16 pm

just paste whatever you do in date-time wizard and then you have the syntax you want, you can then use this.

Who is online

Users browsing this forum: No registered users and 3 guests

cron