Lesson 1, Part 6: Referencing SAS Datasets¶
You can use a two-level name to reference a temporary SAS Data Set, but the libref must be named as WORK.
In [ ]:
data work.Mclass;
set sashelp.class;
where sex='M';
run;
Alternatively, you can use a one-level name to reference a temporary SAS Data Set.
In [ ]:
data Fclass;
set sashelp.class;
where sex='F';
run;
Create a permanent SAS data set in a SAS library
In [ ]:
libname new 'C:\SDS';
data new.Fclass;
set sashelp.class;
where sex='F';
run;
SAS automatically creates a SAS library with the libref SASUSER. You don't need to include the LIBNAME statement.
In [ ]:
data sasuser.Mclass;
set sashelp.class;
where sex='M';
run;
You can use a one-level name in the DATA statement to reference a permanent SAS dataset if your libref is named as USER in the LIBNAME statement.
In [ ]:
libname user 'C:\SASCourse\Week1';
data Fclass_x;
set sashelp.class;
where sex='F';
run;