Iam using sql passthrough and later Iam trying to read the amper variables and one among those amper variable is a date field which looks something like this: &date=2011001
I need to extract only the year part from this date amper variable and I was not successful in getting this done using either the Edit nor other date functions.
Any help on how to do this would be much appreciated!
Thanks a lot in advance!
Regards!This message has been edited. Last edited by: info4pal,
There are multiple options available. Since it is from DB, default column format will be in date. So either use DB functions to extract year from date and then read it in WebFOCUS or you can use WF functions to convert Date format to alpha and then read into amper variable.
I prefer DB conversion as it is simple and straight forward . Thanks, Ram
-SET &DATE_YYMD=20141225;
-SET &DATE_YY=&DATE_YYMD/10000;
-TYPE DATE_YY - &DATE_YY
-EXIT
TABLE FILE CAR
SUM
COMPUTE DATE_YYMD/D20.2=20141225; NOPRINT
COMPUTE DATE_YY/I4=DATE_YYMD/10000;
BY HIGHEST 1 COUNTRY NOPRINT
ON TABLE HOLD FORMAT ALPHA
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN
?FF HOLD
-READ HOLD &DATE_YY.A4.
-TYPE DATE_YY - &DATE_YY