The script initializes a CAS session and assigns all caslibs. It then uses two DATA steps to: 1) Copy the 'baseball' table from SASHELP to the 'casuser' caslib under the same name. 2) Create a new 'baseball2' table in the 'casuser' caslib from 'casuser.baseball', calculating a new variable 'x' as the ratio of 'nruns' divided by 'nhits'. The entire process runs entirely within the Cloud Analytic Services (CAS) engine.
Data Analysis
Type : SASHELP
The primary data source is the 'baseball' table from the SASHELP library, which is an example data library provided by SAS. This data is then copied and manipulated within the 'casuser' caslib.
1 Code Block
CAS Configuration
Explanation : This block configures the CAS session by enabling metrics collection and assigning all available caslibs, which allows access and manipulation of data stored in CAS.
Copied!
cas sessopts=(metrics=true);
caslib _all_ assign;
1
cas sessopts=(metrics=true);
2
caslib _all_ assign;
2 Code Block
DATA STEP Data
Explanation : This DATA step creates a new table named 'baseball' in the 'casuser' caslib. It copies all observations and variables from the 'sashelp.baseball' table to the CAS table, making the data available for distributed processing in CAS.
Copied!
data casuser.baseball;
set sashelp.baseball;
run;
1
2
DATA casuser.baseball;
3
SET sashelp.baseball;
4
RUN;
5
3 Code Block
DATA STEP Data
Explanation : This second DATA step creates a new CAS table named 'baseball2' from the previously created 'casuser.baseball' table. It introduces a new variable 'x' calculated as the ratio of 'nruns' and 'nhits' for each observation. This operation is executed directly in CAS.
Copied!
data casuser.baseball2;
set casuser.baseball;
x=nruns/nhits;
run;
1
DATA casuser.baseball2;
2
SET casuser.baseball;
3
x=nruns/nhits;
4
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.