Hi,
Could some one tell me how I could change this code on the STEP 3 to export as a SAS table instead of a txt file , keeping the same path to be exported I mean keeping this adress "OUTFILE='//SASCommon/jorquec/"
Many thanks ,
/*-----------------MACROS DE DATA ------------------*/
%let today=%sysfunc(today());
%let currdt=%sysfunc(datetime());
data _null_;
date2=intnx("month",&today.,-1,'end');
call symput('ONEDT2',"1"||substr(put(date2,DDMMYYN.),7,2)||substr(put(date2,DDMMYYN.),3,2)||substr(put(date2,DDMMYYN.),1,2));
%put &ONEDT2.;
%put ONEDT2= &ONEDT2.;
month_id = intck('month','01jan1990'd,today());
put month_id=;
call symputx('month_id',month_id);
%put month_id=&month_id;
run;
/*STEP 1 */
Proc SQL;
connect to teradata
(user=&teradata_user. password=&teradata_pwd. server = 'edwprod' database = 'nuc_pl_user_view');
Create table JORQUEC.TESTPAYG as select * from connection to teradata(
select a.ID, a.maxmargin_dt, b.maxmodelmart_d from
(
select
1 as ID,
max(month_end_dt) as maxmargin_dt
from nuc_pl_user_view.pg_margin_stack) as A
left join (
select
1 as ID,
max(month_id) as maxmodelmart_d
from Insights_rm.Consumer_Model_Mart) as B
on a.ID = b.ID
);
disconnect from teradata ;
QUIT;
/* STEP 2 */
DATA JORQUEC.TRIGGERPAYG;
SET JORQUEC.TESTPAYG;
IF (maxmargin_dt >= (&ONEDT2.)/100) and (maxmodelmart_d = &month_id.) then export_flag='Y';
else export_flag='N';
call symputx('export_flag', export_flag);
run;
*check value of macro variable;
%PUT Export_Flag = &export_flag;
/* STEP 3 - PROC EXPORT -*/
%macro test;
%if (&export_flag = 'Y') %then %do;
PROC EXPORT DATA=JORQUEC.TRIGGERPAYG
OUTFILE='//SASCommon/jorquec/TRIGGER_PAYGO.TXT'
DBMS=dlm
REPLACE;
delimiter='&';
RUN;
%end;
%mend;
%test;