diff --git a/all.sas b/all.sas
index a684229..ff0d23a 100644
--- a/all.sas
+++ b/all.sas
@@ -399,7 +399,7 @@ options noquotelenmax;
@version 9.2
@author Allan Bowe
-**/ /** \cond */
+**/
%macro mf_getengine(libref
)/*/STORE SOURCE*/;
@@ -419,9 +419,7 @@ options noquotelenmax;
&engine
-%mend;
-
-/** \endcond *//**
+%mend;/**
@file
@brief Returns the size of a file in bytes.
@details Provide full path/filename.extension to the file, eg:
@@ -1933,29 +1931,50 @@ Usage:
@version 9.2
@author Allan Bowe
+
+
Dependencies
+ @li mp_abort.sas
+ @li mf_existds.sas
+
**/
%macro mp_csv2ds(inref=0,outds=0,baseds=0,view=NO);
-%if &inref=0 %then %do;
- %put %str(ERR)OR: the INREF variable must be provided;
- %let syscc=4;
- %abort;
-%end;
-%if %superq(outds)=0 %then %do;
- %put %str(ERR)OR: the OUTDS variable must be provided;
- %let syscc=4;
- %return;
-%end;
-%if &baseds=0 %then %do;
- %put %str(ERR)OR: the BASEDS variable must be provided;
- %let syscc=4;
- %return;
-%end;
-%if %sysfunc(exist(&BASEDS)) ne 1 & %sysfunc(exist(&BASEDS,VIEW)) ne 1 %then %do;
- %put %str(ERR)OR: the BASEDS dataset (&baseds) needs to be assigned, and to exist;
- %let syscc=4;
- %return;
-%end;
+
+%mp_abort(iftrue=( &inref=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the INREF variable must be provided)
+)
+%mp_abort(iftrue=( %superq(outds)=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the OUTDS variable must be provided)
+)
+%mp_abort(iftrue=( &baseds=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the BASEDS variable must be provided)
+)
+%mp_abort(iftrue=( &baseds=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the BASEDS variable must be provided)
+)
+%mp_abort(iftrue=( %mf_existds(&baseds)=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the BASEDS dataset (&baseds) needs to be assigned, and to exist)
+)
+
+/* count rows */
+%local hasheader; %let hasheader=0;
+data _null_;
+ if _N_ > 1 then do;
+ call symputx('hasheader',1,'l');
+ stop;
+ end;
+ infile &inref;
+ input;
+run;
+%mp_abort(iftrue=( &hasheader=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(No header row in &inref)
+)
/* get the variables in the CSV */
data _data_;
@@ -2020,7 +2039,9 @@ data &outds
;
infile &inref dsd firstobs=2;
input &instat;
- drop &dropvars;
+ %if %length(&dropvars)>0 %then %do;
+ drop &dropvars;
+ %end;
run;
%mend;/**
diff --git a/base/mf_getengine.sas b/base/mf_getengine.sas
index e396bc5..c76f63e 100755
--- a/base/mf_getengine.sas
+++ b/base/mf_getengine.sas
@@ -22,7 +22,7 @@
@version 9.2
@author Allan Bowe
-**/ /** \cond */
+**/
%macro mf_getengine(libref
)/*/STORE SOURCE*/;
@@ -42,6 +42,4 @@
&engine
-%mend;
-
-/** \endcond */
\ No newline at end of file
+%mend;
\ No newline at end of file
diff --git a/base/mp_csv2ds.sas b/base/mp_csv2ds.sas
index dd43c25..65e3db0 100644
--- a/base/mp_csv2ds.sas
+++ b/base/mp_csv2ds.sas
@@ -28,29 +28,50 @@
@version 9.2
@author Allan Bowe
+
+ Dependencies
+ @li mp_abort.sas
+ @li mf_existds.sas
+
**/
%macro mp_csv2ds(inref=0,outds=0,baseds=0,view=NO);
-%if &inref=0 %then %do;
- %put %str(ERR)OR: the INREF variable must be provided;
- %let syscc=4;
- %abort;
-%end;
-%if %superq(outds)=0 %then %do;
- %put %str(ERR)OR: the OUTDS variable must be provided;
- %let syscc=4;
- %return;
-%end;
-%if &baseds=0 %then %do;
- %put %str(ERR)OR: the BASEDS variable must be provided;
- %let syscc=4;
- %return;
-%end;
-%if %sysfunc(exist(&BASEDS)) ne 1 & %sysfunc(exist(&BASEDS,VIEW)) ne 1 %then %do;
- %put %str(ERR)OR: the BASEDS dataset (&baseds) needs to be assigned, and to exist;
- %let syscc=4;
- %return;
-%end;
+
+%mp_abort(iftrue=( &inref=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the INREF variable must be provided)
+)
+%mp_abort(iftrue=( %superq(outds)=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the OUTDS variable must be provided)
+)
+%mp_abort(iftrue=( &baseds=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the BASEDS variable must be provided)
+)
+%mp_abort(iftrue=( &baseds=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the BASEDS variable must be provided)
+)
+%mp_abort(iftrue=( %mf_existds(&baseds)=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(the BASEDS dataset (&baseds) needs to be assigned, and to exist)
+)
+
+/* count rows */
+%local hasheader; %let hasheader=0;
+data _null_;
+ if _N_ > 1 then do;
+ call symputx('hasheader',1,'l');
+ stop;
+ end;
+ infile &inref;
+ input;
+run;
+%mp_abort(iftrue=( &hasheader=0 )
+ ,mac=&sysmacroname
+ ,msg=%str(No header row in &inref)
+)
/* get the variables in the CSV */
data _data_;
@@ -115,7 +136,9 @@ data &outds
;
infile &inref dsd firstobs=2;
input &instat;
- drop &dropvars;
+ %if %length(&dropvars)>0 %then %do;
+ drop &dropvars;
+ %end;
run;
%mend;
\ No newline at end of file