Hi all! Sorry for my late answer. I've been quite busy now before the summer vacation. Thanks for all your answers. I found a solution that's working by using some code I found in a program, but i don't know why this is working and not my earlier tries However, here is what I did: data test; dato = sum(today()-65); DATECRM=PUT(dato,yymmdd10.); run; proc sql noprint; select distinct "'"||strip(DATECRM)||"'" into :DATECRM separated by ' ' from test; quit; %put &DATECRM.; proc sql; connect to oledb as db_edw (provider=sqloledb properties=( "Data Source" = "LHPM-SQL-PROD" "Initial Catalog" = "LHPMMART" "Integrated Security" = "SSPI" "Persist Security Info" = "False") BCP=YES) ; . . . . where b.custbranchorgid='xxxx' and b.isrecent=1 and factdt>&DATECRM. and a.CrmOpportunityPhaseCd=100 ); quit; I can't see who wrote it, but I have as you can see a connection.
... View more