Hi,
I'm trying to change the format of a date/time field.
I'm going into the table, double clicking on a Cell which prompts me to accept editing access.
I then right click & go to Properties to change the Format of the field.
I saw a tutorial to do this to change a Char field to a Number but can't get this to work.
The options given are Informat which I chnage to 'MONYY' & I do the same to the Format option.
The fields turn into this '******' .
Can anyone advise what I'm doing wrong?
Thanks
hi ,
if you want to change the a date/time variable that you want in a mmyyyy format you must extract the date out of the variable first.
use create a new variable and edit
datepart(variable name)
and then pick the right format , i personally use mmyys7.
which give you the month and year with a slash between them
good luck.
Is the field a datetime value? Or simply a date value? The underlying raw value for a datetime value is a number of seconds since midnight on Jan 1, 1960. For a date value, it's a number of days since Jan 1, 1960. A datetime value might not be displayable (and certainly would be incorrect) in the MMYY format. Instead, you probably want the DTMONYY5. format.
See:
Do you mind if we dance with your DATEs (or DATETIMEs)? - The SAS Dummy
Or perhaps you really do have a date value, and you haven't specified a large enough width specifier for the MMYY format. More on formats and lengths:
Lengths and formats: the long and short of it - The SAS Dummy
Chris
Hi Chris,
My mistake, the field to be changed is a Date/Time field & I want to use the feature I described above.
I'm making a mistake in the steps somewhere.
Here are some instructions I was using & adapting to a Date/ Time situation.
From this page; http://support.sas.com/kb/26/012.html
I used the ANYDTTME format for the Informat but it still won't work...
Any suggests?
hi ,
if you want to change the a date/time variable that you want in a mmyyyy format you must extract the date out of the variable first.
use create a new variable and edit
datepart(variable name)
and then pick the right format , i personally use mmyys7.
which give you the month and year with a slash between them
good luck.
Thanks S.boeko.
That's got it !
Cheers
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.