Converting a numeric year to a date formatted year

I have a SAS dataset that has a variable, fiscyear, that are years, but are formatted as numeric. I'm trying to convert that variable to a YEAR4. format so that I can use the years as dates in a proc. The code I'm trying to use (shown below) is producing this error:

NOTE 485-185: Informat YEAR was not found or could not be loaded.

I don't understand why I get this error. Is there a different method I could be using? My code is shown below.

Re: Converting a numeric year to a date formatted year

You are trying to use YEAR as an INFORMAT, when it only exists in SAS as a FORMAT. This means it will only work when you already have a SAS date and you apply it with a PUT function or FORMAT statement.

Try this instead:

fiscyear = mdy(1, 1, input(charyear, 4.));

format fiscyear year4.;

To create a SAS date you also need to tell SAS the day and the month of your date, so that fiscyear actually stores 1 Jan 2014, for example.

Re: Converting a numeric year to a date formatted year

You are trying to use YEAR as an INFORMAT, when it only exists in SAS as a FORMAT. This means it will only work when you already have a SAS date and you apply it with a PUT function or FORMAT statement.

Try this instead:

fiscyear = mdy(1, 1, input(charyear, 4.));

format fiscyear year4.;

To create a SAS date you also need to tell SAS the day and the month of your date, so that fiscyear actually stores 1 Jan 2014, for example.