Task
|
Statement
|
Example
|
---|---|---|
Reference an Excel workbook
file
|
SAS/ACCESS LIBNAME statement
|
LIBNAME cert
libname cert xlsx 'C:UsersStudent1certexercise.xlsx'; |
Write out the contents
of the SAS Library
|
PROC CONTENTS
|
proc contents data=cert._all_; |
Execute the PROC CONTENTS
statement
|
RUN statement
|
run; |
Name and create a new
SAS data set
|
DATA statement
|
data work.stress; |
Read in an Excel worksheet
(as the input data for the new SAS data set)
|
SET statement
|
set cert.ActLevel; |
Execute the DATA step
|
RUN statement
|
run; |
View the contents of
a particular data set
|
PROC PRINT
|
proc print data=stress; |
Execute the PROC PRINT
statement
|
RUN statement
|
run; |
Syntax, SAS/ACCESS LIBNAME
statement:
LIBNAME <libref>XLSX <'physical-path-and-filename.xlsx'><options>;
libname results
XLSX
'C:UsersStudent1certexercise.xlsx'; |
C:UsersStudent1cert
.
libname certxl XLSX 'C:UsersStudent1certexercise.xlsx';
data work.stress; set certxl.ActivityLevels; run;
data work.stress; set certxl.ActivityLevels; where ActLevel='HIGH'; run;
libname certxl xlsx 'C:UsersStudent1certstock.xlsx';
data work.bstock;
set certxl.'boots stock'n;
run;
libname certxl xlsx 'C:UsersStudent1certstock.xlsx';
data work.bstock;
set certxl.'boots stock'n;
run;
proc print data=work.bstock;
run;
libname certxl xlsx 'C:UsersStudent1certstock.xlsx';
proc print data=cerxl.'boots stock'n;
run;