BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
crawfe
Quartz | Level 8

Hi. I am new to TD coding. In DI Studio,  I would like to convert 08JAN2020 date format to mm/yyyy and

use mm/yyyy for my grouping (ie by month/year only, ignore day of the month). In SAS I used this: INPUT(PUT(date,mmyys7.),anydtdte7.

It looks too exotic but it worked good to just give me month/year.

How would I get to the same date value in teradata? Thanks!

(Is this the correct forum for TD questions?).

1 ACCEPTED SOLUTION

Accepted Solutions
crawfe
Quartz | Level 8

Thanks! I will try to get on that TD forum for my specific questions. I have always gotten helpful information here!

That worked, giving me 1Jan2020, which with the monyy7. format, displays "Jan2020". Perfect. Thanks.

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

It looks like you just want to move to the first day of the month.  So in SAS you would just do:

intnx('month',date,0,'b')

For Teradata questions you should ask on a Teradata forum.  But looking around quickly I found this post that seems to do what you want.

DATE - (EXTRACT(DAY FROM DATE)-1)

https://support.teradata.com/community?id=community_question&sys_id=2bba0b6f1b97fb00682ca8233a4bcba5

crawfe
Quartz | Level 8

Thanks! I will try to get on that TD forum for my specific questions. I have always gotten helpful information here!

That worked, giving me 1Jan2020, which with the monyy7. format, displays "Jan2020". Perfect. Thanks.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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