1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-03 07:40:04 +00:00

fix: updating mp_getddl to enable append to a fileref

This commit is contained in:
Allan Bowe
2021-07-28 17:01:49 +03:00
parent 00fa464a7c
commit 5b5d01993f
2 changed files with 14 additions and 10 deletions

12
all.sas
View File

@@ -4397,12 +4397,13 @@ run;
%mp_getddl(work,test,flavour=tsql,showlog=YES)
<h4> SAS Macros </h4>
@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;

View File

@@ -16,12 +16,13 @@
%mp_getddl(work,test,flavour=tsql,showlog=YES)
<h4> SAS Macros </h4>
@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;