mirror of
https://github.com/sasjs/core.git
synced 2026-01-07 09:30:06 +00:00
fix: making view an option so that existence can be checked for
This commit is contained in:
18
all.sas
18
all.sas
@@ -1925,7 +1925,9 @@ Usage:
|
|||||||
|
|
||||||
|
|
||||||
@param inref= fileref to the CSV
|
@param inref= fileref to the CSV
|
||||||
@param outds= output ds. Could also be a view (eg `outds=myds/view=myds`)
|
@param outds= output ds (lib.ds format)
|
||||||
|
@param view= Set to YES or NO to determine whether the output should be
|
||||||
|
a view or not. Default is NO (not a view).
|
||||||
@param baseds= Template dataset on which to create the input statement.
|
@param baseds= Template dataset on which to create the input statement.
|
||||||
Is used to determine types, lengths, and any informats.
|
Is used to determine types, lengths, and any informats.
|
||||||
|
|
||||||
@@ -1939,7 +1941,7 @@ Usage:
|
|||||||
%let syscc=4;
|
%let syscc=4;
|
||||||
%abort;
|
%abort;
|
||||||
%end;
|
%end;
|
||||||
%if &outds=0 %then %do;
|
%if %superq(outds)=0 %then %do;
|
||||||
%put %str(ERR)OR: the OUTDS variable must be provided;
|
%put %str(ERR)OR: the OUTDS variable must be provided;
|
||||||
%let syscc=4;
|
%let syscc=4;
|
||||||
%return;
|
%return;
|
||||||
@@ -1949,6 +1951,11 @@ Usage:
|
|||||||
%let syscc=4;
|
%let syscc=4;
|
||||||
%return;
|
%return;
|
||||||
%end;
|
%end;
|
||||||
|
%if %sysfunc(exist(&BASEDS)) ne 1 & %sysfunc(exist(&BASEDS,VIEW)) ne 1 %then %do;
|
||||||
|
%put %str(ERR)OR: the BASEDS dataset needs to be assigned, and to exist;
|
||||||
|
%let syscc=4;
|
||||||
|
%return;
|
||||||
|
%end;
|
||||||
|
|
||||||
/* get the variables in the CSV */
|
/* get the variables in the CSV */
|
||||||
data _data_;
|
data _data_;
|
||||||
@@ -2004,7 +2011,12 @@ data _null_;
|
|||||||
end;
|
end;
|
||||||
run;
|
run;
|
||||||
|
|
||||||
data &outds;
|
/* import the CSV */
|
||||||
|
data &outds
|
||||||
|
%if %upcase(&view)=YES %then %do;
|
||||||
|
/view=&outds
|
||||||
|
%end;
|
||||||
|
;
|
||||||
infile &inref dsd firstobs=2;
|
infile &inref dsd firstobs=2;
|
||||||
input &instat;
|
input &instat;
|
||||||
drop &dropvars;
|
drop &dropvars;
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
|
|
||||||
@param inref= fileref to the CSV
|
@param inref= fileref to the CSV
|
||||||
@param outds= output ds. Could also be a view (eg `outds=myds/view=myds`)
|
@param outds= output ds (lib.ds format)
|
||||||
|
@param view= Set to YES or NO to determine whether the output should be
|
||||||
|
a view or not. Default is NO (not a view).
|
||||||
@param baseds= Template dataset on which to create the input statement.
|
@param baseds= Template dataset on which to create the input statement.
|
||||||
Is used to determine types, lengths, and any informats.
|
Is used to determine types, lengths, and any informats.
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
%let syscc=4;
|
%let syscc=4;
|
||||||
%abort;
|
%abort;
|
||||||
%end;
|
%end;
|
||||||
%if &outds=0 %then %do;
|
%if %superq(outds)=0 %then %do;
|
||||||
%put %str(ERR)OR: the OUTDS variable must be provided;
|
%put %str(ERR)OR: the OUTDS variable must be provided;
|
||||||
%let syscc=4;
|
%let syscc=4;
|
||||||
%return;
|
%return;
|
||||||
@@ -44,6 +46,11 @@
|
|||||||
%let syscc=4;
|
%let syscc=4;
|
||||||
%return;
|
%return;
|
||||||
%end;
|
%end;
|
||||||
|
%if %sysfunc(exist(&BASEDS)) ne 1 & %sysfunc(exist(&BASEDS,VIEW)) ne 1 %then %do;
|
||||||
|
%put %str(ERR)OR: the BASEDS dataset needs to be assigned, and to exist;
|
||||||
|
%let syscc=4;
|
||||||
|
%return;
|
||||||
|
%end;
|
||||||
|
|
||||||
/* get the variables in the CSV */
|
/* get the variables in the CSV */
|
||||||
data _data_;
|
data _data_;
|
||||||
@@ -100,7 +107,11 @@ data _null_;
|
|||||||
run;
|
run;
|
||||||
|
|
||||||
/* import the CSV */
|
/* import the CSV */
|
||||||
data &outds;
|
data &outds
|
||||||
|
%if %upcase(&view)=YES %then %do;
|
||||||
|
/view=&outds
|
||||||
|
%end;
|
||||||
|
;
|
||||||
infile &inref dsd firstobs=2;
|
infile &inref dsd firstobs=2;
|
||||||
input &instat;
|
input &instat;
|
||||||
drop &dropvars;
|
drop &dropvars;
|
||||||
|
|||||||
Reference in New Issue
Block a user