diff --git a/all.sas b/all.sas
index 8a6a908..37ade71 100644
--- a/all.sas
+++ b/all.sas
@@ -4397,12 +4397,13 @@ run;
%mp_getddl(work,test,flavour=tsql,showlog=YES)
SAS Macros
+ @li mf_existfileref.sas
@li mp_getconstraints.sas
@param lib libref of the library to create DDL for. Should be assigned.
@param ds dataset to create ddl for (optional)
- @param fref= the fileref to which to write the DDL. If not preassigned, will
- be assigned to TEMP.
+ @param fref= the fileref to which to _append_ the DDL. If it does not exist,
+ it will be created.
@param flavour= The type of DDL to create (default=SAS). Supported=TSQL
@param showlog= Set to YES to show the DDL in the log
@param schema= Choose a preferred schema name (default is to use actual schema
@@ -4418,9 +4419,10 @@ run;
)/*/STORE SOURCE*/;
/* check fileref is assigned */
-%if %sysfunc(fileref(&fref)) > 0 %then %do;
- filename &fref temp;
+%if %mf_existfileref(&outref)=0 %then %do;
+ filename &outref temp ;
%end;
+
%if %length(&libref)=0 %then %let libref=WORK;
%let flavour=%upcase(&flavour);
@@ -4499,7 +4501,7 @@ create table _data_ as
%mend addConst;
data _null_;
- file &fref;
+ file &fref mod;
put "/* DDL generated by &sysuserid on %sysfunc(datetime(),datetime19.) */";
run;
diff --git a/base/mp_getddl.sas b/base/mp_getddl.sas
index be92303..4b7d400 100644
--- a/base/mp_getddl.sas
+++ b/base/mp_getddl.sas
@@ -16,12 +16,13 @@
%mp_getddl(work,test,flavour=tsql,showlog=YES)
SAS Macros
+ @li mf_existfileref.sas
@li mp_getconstraints.sas
@param lib libref of the library to create DDL for. Should be assigned.
@param ds dataset to create ddl for (optional)
- @param fref= the fileref to which to write the DDL. If not preassigned, will
- be assigned to TEMP.
+ @param fref= the fileref to which to _append_ the DDL. If it does not exist,
+ it will be created.
@param flavour= The type of DDL to create (default=SAS). Supported=TSQL
@param showlog= Set to YES to show the DDL in the log
@param schema= Choose a preferred schema name (default is to use actual schema
@@ -37,9 +38,10 @@
)/*/STORE SOURCE*/;
/* check fileref is assigned */
-%if %sysfunc(fileref(&fref)) > 0 %then %do;
- filename &fref temp;
+%if %mf_existfileref(&outref)=0 %then %do;
+ filename &outref temp ;
%end;
+
%if %length(&libref)=0 %then %let libref=WORK;
%let flavour=%upcase(&flavour);
@@ -118,7 +120,7 @@ create table _data_ as
%mend addConst;
data _null_;
- file &fref;
+ file &fref mod;
put "/* DDL generated by &sysuserid on %sysfunc(datetime(),datetime19.) */";
run;