Carol Sundy Posted July 1, 2021 Posted July 1, 2021 Hi, Im using App Studio 8207.18 and would like to convert an integer like a ProcessDateKey YYYYMMDD (20210701) to an integer that strips off the day, YYYYMM (202107) Does anyone have a recommendation Thanks. Carol Sundy
Carol Sundy Posted July 1, 2021 Author Posted July 1, 2021 I know how to convert the integer to a date in YYYYMM format. Is there a way to convert it from a date to integer Thanks.
David Beagan Posted July 1, 2021 Posted July 1, 2021 You are looking for something like this TABLE FILE ggsales PRINT SEQ_NO COMPUTE ProcessDateKey/YYMD = &YYMD; COMPUTE ProcessDateKey2/I8YYMD = ProcessDateKey; COMPUTE ProcessDateKey3/I8 = ProcessDateKey2; WHERE RECORDLIMIT IS 1 END
Charles Morris 2 Posted July 1, 2021 Posted July 1, 2021 try using the DATECVT function - this will change it to different formats and if you get it to an I6YYMD then the integer part is simple
Carol Sundy Posted July 1, 2021 Author Posted July 1, 2021 David, I tweaked 2 of the lines of code and it worked! COMPUTE ProcessDateKey2/I6YYM = ProcessDateKey; COMPUTE ProcessDateKey3/I6 = ProcessDateKey2; Thanks for the suggestion! Carol
Carol Sundy Posted July 1, 2021 Author Posted July 1, 2021 Charles, I also tried your recommendation in my meta and it worked! DATECVT( WEEK_START_YYYYMM, YY|M, I6YYM) Now I have 2 methods! Thanks so much! Carol
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now