Separate Year from a date

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Separate Year from a date

Kuiama Thompson

Hi All

 

I have a date variable (dd-mmm-yyyy) and I would like to create another variable which is just the year from the first variable.  I thought it would be straightforward but I can’t seem to get anything to work.  I’m obviously missing something.  Can anyone help?

 

Thanks,

 

Kind Regards
Kuiama Thompson
Health Equity Officer
NHS Salford
St James's House
Pendleton Way

Salford, M6 5FW


Tel: 0161 212 4919

Mobile: 07766 026 561

Email: [hidden email]

 

 

 

DISCLAIMER:
This email has been scanned for viruses, however we are unable to accept responsibility for any damage caused by the contents. The opinions expressed in this email represent the views of the sender, not Salford PCT unless explicitly stated. If you have received this email in error please notify the sender. The information contained in this email may be subject to public disclosure under the NHS Code of Openness or the Freedom of Information Act 2000. Unless the information is legally exempt from disclosure, the confidentiality of this e-mail and your reply cannot be guaranteed.

Reply | Threaded
Open this post in threaded view
|

Automatic reply: Separate Year from a date

Kelly Vander Ley

I will be out of the office from June 22-June 25, returning on the 28th. I will be checking e-mail on a limited basis. If you need immediate assistance please contact me at 503/539-5606. Thank you. Kelly

 

Reply | Threaded
Open this post in threaded view
|

Re: Separate Year from a date

Ruben Geert van den Berg
In reply to this post by Kuiama Thompson
Dear Kuiama,
 
I think you could use some xdate function for this. Please try the code below.
 
HTH,

Ruben van den Berg
Consultant Models & Methods
TNS NIPO
Email: [hidden email]
Mobiel: +31 6 24641435
Telefoon: +31 20 522 5738
Internet: www.tns-nipo.com

*Testdata.

data list free/date(edate10).
begin data
25-03-2010
1-1-1775
15-9-1978
end data.
 
*Extract year.
 
compute year=xdate.year(date).
execute.
 
*Hide decimals.

formats year(f1).

 

Date: Tue, 22 Jun 2010 10:11:01 +0100
From: [hidden email]
Subject: Separate Year from a date
To: [hidden email]

Hi All

 

I have a date variable (dd-mmm-yyyy) and I would like to create another variable which is just the year from the first variable.  I thought it would be straightforward but I can’t seem to get anything to work.  I’m obviously missing something.  Can anyone help?

 

Thanks,

 

Kind Regards
Kuiama Thompson
Health Equity Officer
NHS Salford
St James's House
Pendleton Way

Salford, M6 5FW


Tel: 0161 212 4919

Mobile: 07766 026 561

Email: [hidden email]

 

 

 


DISCLAIMER:
This email has been scanned for viruses, however we are unable to accept responsibility for any damage caused by the contents. The opinions expressed in this email represent the views of the sender, not Salford PCT unless explicitly stated. If you have received this email in error please notify the sender. The information contained in this email may be subject to public disclosure under the NHS Code of Openness or the Freedom of Information Act 2000. Unless the information is legally exempt from disclosure, the confidentiality of this e-mail and your reply cannot be guaranteed.


New Windows 7: Find the right PC for you. Learn more.