DATECVT won't work directly on these dates as it is in MDYY ,so tried to convert to YYMD. No ready to use functions are available as far as i undersatnd. So i spitted the MDYY and then joined back in YYMD format as below.
My belief is that &START_DATE_YYMD is of A8YYMD format now.
SO tried to apply DATECVT on that to convert to YYMD.But it is not working. Eventually i have to calculate previous year for the dates.To use DATEADD function i need to convert the dates to YYMD. Am i doing something wrong? Code below.
-DEFAULT &START_DATE = '04/02/2018' ;
-DEFAULT &END_DATE = '04/05/2018' ;
-DEFAULT &PRIOR_START_DATE = '01/02/2017' ;
-DEFAULT &PRIOR_END_DATE = '02/01/2017' ;
-SET &DATE_M = EDIT(&START_DATE,'99');
-SET &DATE_D = EDIT(&START_DATE,'$$$99');
-SET &DATE_YY = EDIT(&START_DATE,'$$$$$$9999');
-SET &START_DATE_YYMD = &DATE_YY||&DATE_M||&DATE_D;
-SET &PRIOR_START_DATE = DATECVT(&START_DATE_YYMD,'A8YYMD','YYMD');
-*-SET &PRIOR_START_DATE = DATEADD(&START_DATE_YYMD,'Y',-1);
Any suggestions ?This message has been edited. Last edited by: srajeevan,
Chuck Wolff - Focal Point Moderator WebFOCUS 7x and 8x, Windows, Linux All output Formats
October 11, 2018, 11:55 AM
Thanks for the reply. You are calculating previous year from a YYMD date,but for my requirement,the date is in MDYY format.
If the date is YYMD format i can directly use DATECVT function or the AYMD function you provided. Date being in MDYY is creating trouble for me as converting MDYY to YYMD is not happening properly when i split the date to components.