Examples use generated data (datalines) or SASHELP.
1 Code Block
DATA STEP Data
Explanation : The LIBNAME statement assigns the myfiles libref and the V9 engine to a library location. Replace 'library-path' with your library's location. The location must exist and be accessible by the SAS compute server. The DATA step creates the myclass dataset in the myfiles library by copying the class dataset from the sashelp library.
Copied!
libname myfiles v9 'library-path';
data myfiles.myclass;
set sashelp.class;
run;
1
LIBNAME myfiles v9 'library-path';
2
DATA myfiles.myclass;
3
SET sashelp.class;
4
RUN;
2 Code Block
LIBNAME
Explanation : This part of the LIBNAME statement assigns the mylib libref and the SPD engine to a primary path name. The first (and usually the only) metadata file for a data set is always stored in the primary path for the library. You can optionally assign one or more path names in the DATAPATH= option to store data partitions. Otherwise, the data partition files are stored in the primary path. You can optionally assign one or more path names in the INDEXPATH= option to store index files. Otherwise, the index files are stored in the primary path.
Explanation : The SET= system option sets environment variables for Hadoop. If these environment variables are already set (for example, during configuration), do not submit these lines of code. If these environment variables are not correctly set, the LIBNAME statement produces errors in the SAS log. The LIBNAME statement assigns the mydata libref to the SPD engine and to a directory in the Hadoop cluster. The HDFS=YES argument specifies the connection to the Hadoop cluster defined in the Hadoop cluster configuration files. The ACCELWHERE=YES option requests that data subsetting be performed by a MapReduce program in the Hadoop cluster.
Explanation : This LIBNAME statement assigns the srclib library to the CVP engine and to the location of the data that you want to copy. The CVPENGINE= option specifies the V9 engine as the underlying engine for processing the data. The CVPMULT= option specifies a multiplication factor of 2.5 to expand all character variables. If this option is not specified, the CVP engine automatically chooses a multiplying value. This LIBNAME statement assigns the target library to hold the copied data. The COPY procedure with the SELECT statement copies the myclass dataset to the target library. During copying, the CVP engine expands the lengths of the character variables by 2.5 times: For 'Name', 8 × 2.5 = 20. For 'Sex', 1 × 2.5 = 2.5, which rounds up to 3.
Explanation : The CAS statement starts a CAS session and specifies casauto as the CAS session name. Use your connection information in the HOST= and PORT= options. The LIBNAME statement assigns the mycas libref to the CAS engine. The LIBNAME SESSREF= option is not specified, so the engine uses the casauto session. The DATA step copies the SAS dataset sashelp.cars to the CAS session. The PROMOTE=YES dataset option promotes the table with global scope. The CONTENTS procedure shows that the mycas.cars table is available on the CAS server for the duration of the session. Once the data is loaded into memory, subsequent steps can process the in-memory data. Loading and processing are done in separate steps.
Copied!
cas casauto host="cloud.example.com" port=5570;
libname mycas cas;
data mycas.cars (promote=yes);
set sashelp.cars;
run;
proc contents data=mycas.cars;
run;
1
cas casauto host="cloud.example.com" port=5570;
2
3
LIBNAME mycas cas;
4
DATA mycas.cars (promote=yes);
5
SET sashelp.cars;
6
RUN;
7
PROC CONTENTSDATA=mycas.cars;
8
RUN;
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.
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.