I am using SAS to bring over a table that sits in a Microsoft SQL Server and and dump it into Hadoop. The problem I am facing is that the data variable: INSURANCE_DATE.Week_Start_Date is a Datetime 22.3, but needs to be converted into yymmddn8. I am bringing 3 years of data over, the entry code piece:
%let three_year_start=%sysfunc(putn(%sysfunc ( intnx(year,%sysfunc(today()), -3)), yymmddn8.)); /* */ %let three_year_end=%sysfunc(putn(%sysfunc(today()), yymmddn8.)); /is today/
works fine, but I am not sure how to format INSURANCE_DATE.Week_Start_Date properly so that my where clause works.
%let three_year_start=%sysfunc(putn(%sysfunc (
intnx(year,%sysfunc(today()), -3)), yymmddn8.)); /* */
%let three_year_end=%sysfunc(putn(%sysfunc(today()), yymmddn8.)); /*is
today*/
proc SQL;
create table BA_INS as
SELECT
format (INSURANCE_DATE.Week_Start_Date) yymmdd10.) as Week_Start_Date
FROM
dbo.DIM_INSURANCE_DATE
WHERE
(dbo.DIM_INSURANCE_DATE.Week_Start_Date
between &three_year_start. and &three_year_end.);
quit;
I need a solution as how to convert that datatime 22.3 format into yymmdd10. within the proc sql query
DBO.DIM_INSURANCE_DATE.Week_Start_Date
? That is not a valid variable name, it has too many periods in it. Are you looking for how to create macro variables that you can push into your remote database via a pass thru SQL query? If so please clarify what syntax your remote database supports. – Tom