1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-18 05:50:06 +00:00

Merge pull request #141 from sasjs/dirlistfix

fix: dirlist logic
This commit is contained in:
Allan Bowe
2022-01-11 12:13:01 +02:00
committed by GitHub
2 changed files with 30 additions and 20 deletions

11
all.sas
View File

@@ -4055,12 +4055,12 @@ run;
* The above transpose can mean that some updates create additional columns. * The above transpose can mean that some updates create additional columns.
* This necessitates the occasional use of datastep over proc append. * This necessitates the occasional use of datastep over proc append.
*/ */
%local basevars appvars usedatastep; %if %mf_existds(&outds) %then %do;
%local basevars appvars newvars;
%let basevars=%mf_getvarlist(&outds); %let basevars=%mf_getvarlist(&outds);
%let appvars=%mf_getvarlist(&out_ds); %let appvars=%mf_getvarlist(&out_ds);
%let newvars=%length(%mf_wordsinstr1butnotstr2(Str1=&appvars,Str2=&basevars)); %let newvars=%length(%mf_wordsinstr1butnotstr2(Str1=&appvars,Str2=&basevars));
%if &newvars>0 %then %do;
%if %mf_existds(&outds) and &newvars>0 %then %do;
data &outds; data &outds;
set &outds &out_ds; set &outds &out_ds;
run; run;
@@ -4069,6 +4069,11 @@ run;
proc append base=&outds data=&out_ds force nowarn; proc append base=&outds data=&out_ds force nowarn;
run; run;
%end; %end;
%end;
%else %do;
proc append base=&outds data=&out_ds;
run;
%end;
/* recursive call */ /* recursive call */
%if &maxdepth>&level or &maxdepth=MAX %then %do; %if &maxdepth>&level or &maxdepth=MAX %then %do;

View File

@@ -198,12 +198,12 @@ run;
* The above transpose can mean that some updates create additional columns. * The above transpose can mean that some updates create additional columns.
* This necessitates the occasional use of datastep over proc append. * This necessitates the occasional use of datastep over proc append.
*/ */
%local basevars appvars usedatastep; %if %mf_existds(&outds) %then %do;
%local basevars appvars newvars;
%let basevars=%mf_getvarlist(&outds); %let basevars=%mf_getvarlist(&outds);
%let appvars=%mf_getvarlist(&out_ds); %let appvars=%mf_getvarlist(&out_ds);
%let newvars=%length(%mf_wordsinstr1butnotstr2(Str1=&appvars,Str2=&basevars)); %let newvars=%length(%mf_wordsinstr1butnotstr2(Str1=&appvars,Str2=&basevars));
%if &newvars>0 %then %do;
%if %mf_existds(&outds) and &newvars>0 %then %do;
data &outds; data &outds;
set &outds &out_ds; set &outds &out_ds;
run; run;
@@ -212,6 +212,11 @@ run;
proc append base=&outds data=&out_ds force nowarn; proc append base=&outds data=&out_ds force nowarn;
run; run;
%end; %end;
%end;
%else %do;
proc append base=&outds data=&out_ds;
run;
%end;
/* recursive call */ /* recursive call */
%if &maxdepth>&level or &maxdepth=MAX %then %do; %if &maxdepth>&level or &maxdepth=MAX %then %do;