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

Compare commits

...

1 Commits

2 changed files with 136 additions and 116 deletions

16
all.sas
View File

@@ -4398,6 +4398,7 @@ run;
<h4> SAS Macros </h4> <h4> SAS Macros </h4>
@li mf_existfileref.sas @li mf_existfileref.sas
@li mf_getvarcount.sas
@li mp_getconstraints.sas @li mp_getconstraints.sas
@param lib libref of the library to create DDL for. Should be assigned. @param lib libref of the library to create DDL for. Should be assigned.
@@ -4685,6 +4686,17 @@ run;
put "CREATE SCHEMA &schema;"; put "CREATE SCHEMA &schema;";
%do x=1 %to %sysfunc(countw(&dsnlist)); %do x=1 %to %sysfunc(countw(&dsnlist));
%let curds=%scan(&dsnlist,&x); %let curds=%scan(&dsnlist,&x);
%local curdsvarcount;
%let curdsvarcount=%mf_getvarcount(&libref..&curds);
%if &curdsvarcount>1600 %then %do;
data _null_;
file &fref mod;
put "/* &libref..&curds contains &curdsvarcount vars */";
put "/* Postgres cannot create tables with over 1600 vars */";
put "/* No DDL will be generated for this table";
run;
%end;
%else %do;
data _null_; data _null_;
file &fref mod; file &fref mod;
put "/* Postgres Flavour DDL for &schema..&curds */"; put "/* Postgres Flavour DDL for &schema..&curds */";
@@ -4738,18 +4750,16 @@ run;
); );
file &fref mod; file &fref mod;
by idxusage indxname; by idxusage indxname;
/* ds=cats(libname,'.',memname); */
if first.indxname then do; if first.indxname then do;
put 'CREATE UNIQUE INDEX "' indxname +(-1) '" ' "ON &schema..&curds("; put 'CREATE UNIQUE INDEX "' indxname +(-1) '" ' "ON &schema..&curds(";
put ' "' name +(-1) '"' ; put ' "' name +(-1) '"' ;
end; end;
else put ' ,"' name +(-1) '"'; else put ' ,"' name +(-1) '"';
*else put ' ,' name ;
if last.indxname then do; if last.indxname then do;
put ');'; put ');';
end; end;
run; run;
%end;
%end; %end;
%end; %end;
%if %upcase(&showlog)=YES %then %do; %if %upcase(&showlog)=YES %then %do;

View File

@@ -17,6 +17,7 @@
<h4> SAS Macros </h4> <h4> SAS Macros </h4>
@li mf_existfileref.sas @li mf_existfileref.sas
@li mf_getvarcount.sas
@li mp_getconstraints.sas @li mp_getconstraints.sas
@param lib libref of the library to create DDL for. Should be assigned. @param lib libref of the library to create DDL for. Should be assigned.
@@ -304,6 +305,17 @@ run;
put "CREATE SCHEMA &schema;"; put "CREATE SCHEMA &schema;";
%do x=1 %to %sysfunc(countw(&dsnlist)); %do x=1 %to %sysfunc(countw(&dsnlist));
%let curds=%scan(&dsnlist,&x); %let curds=%scan(&dsnlist,&x);
%local curdsvarcount;
%let curdsvarcount=%mf_getvarcount(&libref..&curds);
%if &curdsvarcount>1600 %then %do;
data _null_;
file &fref mod;
put "/* &libref..&curds contains &curdsvarcount vars */";
put "/* Postgres cannot create tables with over 1600 vars */";
put "/* No DDL will be generated for this table";
run;
%end;
%else %do;
data _null_; data _null_;
file &fref mod; file &fref mod;
put "/* Postgres Flavour DDL for &schema..&curds */"; put "/* Postgres Flavour DDL for &schema..&curds */";
@@ -357,18 +369,16 @@ run;
); );
file &fref mod; file &fref mod;
by idxusage indxname; by idxusage indxname;
/* ds=cats(libname,'.',memname); */
if first.indxname then do; if first.indxname then do;
put 'CREATE UNIQUE INDEX "' indxname +(-1) '" ' "ON &schema..&curds("; put 'CREATE UNIQUE INDEX "' indxname +(-1) '" ' "ON &schema..&curds(";
put ' "' name +(-1) '"' ; put ' "' name +(-1) '"' ;
end; end;
else put ' ,"' name +(-1) '"'; else put ' ,"' name +(-1) '"';
*else put ' ,' name ;
if last.indxname then do; if last.indxname then do;
put ');'; put ');';
end; end;
run; run;
%end;
%end; %end;
%end; %end;
%if %upcase(&showlog)=YES %then %do; %if %upcase(&showlog)=YES %then %do;