Desktop productivity for business analysts and programmers

EG: How to extract month and year from datetime field

Accepted Solution Solved
Reply
Contributor
Posts: 21
Accepted Solution

EG: How to extract month and year from datetime field

Using the GUI in Enterprise Guide. I want to create a computed field, based on a datetime field, that will show simply "MMM-YY"  for grouping purposes.  I can only find help for basic SAS programming, so I'm at a loss. 

Thanks, in advance, for your help!!

Rita Yee

Project Engineer

FedEx Express


Accepted Solutions
Solution
a month ago
Super User
Posts: 20,222

Re: EG: How to extract month and year from datetime field

[ Edited ]

Compute Column

 

DATEPART() to obtain date.

 

Apply a format, MONYY7. for example? I don't see one that exactly matches what you want, so you may need to create your own. 

https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0p2fmevfgj...

 

 

View solution in original post


All Replies
Solution
a month ago
Super User
Posts: 20,222

Re: EG: How to extract month and year from datetime field

[ Edited ]

Compute Column

 

DATEPART() to obtain date.

 

Apply a format, MONYY7. for example? I don't see one that exactly matches what you want, so you may need to create your own. 

https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0p2fmevfgj...

 

 

Contributor
Posts: 21

Re: EG: How to extract month and year from datetime field

I made that way more difficult than it needed to be Smiley Happy  That "format" step always gets me.  I'm always doing things twice because I forget to format it properly on the front end.   Sigh

 

THANKS AGAIN Smiley Happy

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 104 views
  • 0 likes
  • 2 in conversation