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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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