03-13-2014 10:50 AM
I am obviously a self taught SAS user and a newbie. Any sort of help is appreciated.
I have a variable called EVENTDATE and according to PROC CONTENTS the format for this variable is DATETIME22.3. I would like to run an analysis using only the year part --not interested about the month, day or time. Can anyone tell me the sas code so I can extract the year so I can run a basic analysis?
03-13-2014 10:58 AM
There are various ways, using DATEPART and YEAR function or DTYEAR format, see below
03-13-2014 11:22 AM
Mr. Bruno Muller thank you. It worked but for some reason the only year the comes out is 2014. I can see in the LOG that my EVENTDATE are all from today.
When i looked in the SQL server database I am using, the dates ranged from 2008-2014. Any idea what might be going on?