I have a Teradata query which I am running using SAS. Once of the Teradata fields I am trying to read has a series of digits which is in string format that basically refers to a date. In the Teradata Field the value is 170919 which mean 2017-09-19. I am unable to convert this value into a valid datetype. Can you please help.
proc sql;
connect to teradata (schema=&terasilo user=&terauser password=&terapass tdpid=&teradbase);
create table COL_ASPECT_CALLS_2 as
select * from connection to teradata(
select
top 10 *
from &&terasilo..DMI_COL_ASPECT_CALLS
where CAST(PROD_DATE_CH AS DATE FORMAT 'yymmdd')='2017-09-19'
);
disconnect from teradata;
quit;
PROD_DATE_CH ='170919'instead of CASTing the string to a date` - dnoeth%let nextmnth=%bquote('%sysfunc(intnx(month,&dateliteral,1,b),yymmddn6)');. Once you have the string on the SAS side you can use INPUT function to convert it to a real date. - Tom