This macro takes as input the name of a table and its library (default 'work'). It checks for the existence of the source table, loads it into memory in the CAS library via a Data Step, then uses the CASUTIL procedure to persistently save the table in the target CASLIB.
Data Analysis
Type : EXTERNAL
The macro expects an existing table provided as a parameter (variable &cas_indsn in library &lib).
1 Code Block
MACRO
Explanation : Macro definition, default value management for the library (WORK), and verification of the source table's existence. If the table does not exist, the process stops.
Copied!
%macro etl_dim_data_into_cas(cas_indsn,lib=);
/*add data into cas*/
%if "&lib"="" %then %do;
%let lib=work;
%end;
/*check if input dataset exists or not, if exists then not blank*/
%let dsn= &lib..&cas_indsn.;
%if not %sysfunc(exist(&dsn.)) %then %do;
%put ERROR: &dsn. does not exist. Exiting the process.;
%goto ERREXIT;
%end;
%let cas_indsn=%upcase(%qleft(%qtrim(%bquote(&cas_indsn.))));
1
%macro etl_dim_data_into_cas(cas_indsn,lib=);
2
3
/*add data into cas*/
4
%IF"&lib"="" %THEN %DO;
5
%let lib=work;
6
%END;
7
8
/*check if input dataset exists or not, if exists then not blank*/
9
%let dsn= &lib..&cas_indsn.;
10
%IF not %sysfunc(exist(&dsn.)) %THEN %DO;
11
%put ERROR: &dsn. does not exist. Exiting the process.;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright (C) 2021 SAS Institute, Inc. All rights reserved.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.