LWSPAGS903
LWSPAGS903
Tasks
3.1 Managing Data......................................................................................................................... 3-3
Demonstration: Registering SAS Library and Table Metadata in SAS Environment
Manager ....................................................................................................... 3-6
Practice ................................................................................................................................. 3-12
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Managing Data 3-3
Hadoop
RDBMS XML
SAS Excel
CSV ODBC
2
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
SAS uses an engine associated with the data source to access the data. An engine is a
component of SAS software that enables SAS to access files in a particular format.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-4 Lesson 3 Data Management Tasks
Library Table
physical
physical file
location
register in metadata
connection
description
information
3
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
SAS uses the concept of libraries to access data tables. A library is a collection of data of the
same type that is stored in the same location. The library could be a folder or directory on your
operating system or a relational database. The library definition provides two primary pieces of
information to access your tables:
The data type determines the appropriate engine to use to access the data. Library-specific
options are also included in the definition.
Table definitions include the table name and the descriptor information of the columns (names,
types, attributes) and indexes. A table definition also includes its associated library.
Registering libraries and tables in metadata makes the data easier to access for the SAS
clients. All the information about the data is stored centrally in the metadata.
Registering libraries and tables also enables a layer of security using metadata authorization.
Before a user can access a table, they must be authorized in metadata to the library and the
table as well as at the data storage level. The storage level permissions can be operating
system permissions on the directory or file. Or, if accessing a table in a database server, the
permissions of the database are enforced. No matter where the data is located, a user must
have access at all levels.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Managing Data 3-5
Assigning a Library
Pre-assigned metadata
4
Copyr i ght © SAS I nsti tute I nc. Al l r i ghts reser ved.
Before a client application can access data in code that it generates, the library must be
assigned to the SAS server that executes the code.
• By default, libraries are assigned by the client applications when a user tries to access a
library. In other words, library assignment is deferred until it is needed.
• Configuration in metadata pre-assigns the library when the server executing the code
starts. The data is accessible immediately because the library is established before any
code that uses it is executed.
• A program can include the code with the necessary options to assign the library for use
in the program.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-6 Lesson 3 Data Management Tasks
3. The Libraries page displays a table of all library definitions in the SAS Metadata Server. You can
filter by library type, as well as search the table, sort the table by a selected column, and choose
which columns appear in the table.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Managing Data 3-7
4. To register a new library, click the New Library button in the upper right toolbar.
Enter Orion Gold ship1 for the metadata library name. (The libref, ship1, is included in the
metadata library object name as an example of an access structure that you can use for the SAS
users.)
5. Click Browse to navigate to the SAS Folder location. This is the location in metadata where the
library is going to be stored.
6. Navigate to SAS Folders > Orion Star > Sales Department > Data and click OK.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-8 Lesson 3 Data Management Tasks
9. Scroll down and select the box next to the path of the physical storage of the data.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Managing Data 3-9
Note: If the path was not already defined, click the Add button in the upper right toolbar
and enter it manually.
10. Click Save.
11. Select Assigned SAS Servers on the Orion Gold ship1 library properties page.
12. Click the pencil to edit the servers, select the box next to SASApp, and click Save.
Note: This assignment makes the library available to the servers in the SASApp application
server context.
13. Now the tables can be registered for this library. Select Tables on the Orion Gold ship1 library
properties page.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-10 Lesson 3 Data Management Tasks
15. The registered tables will be stored in the same folder in metadata as the library definition.
Change the location to /Orion Star/Sales Department/Data by using the Browse button if the
location is not already selected. Select CUSTOMER_DIM, GEOGRAPHY_DIM,
ORGANIZATION_DIM, and TIME_DIM and click OK.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Managing Data 3-11
17. The library and tables are stored in the Orion Star > Sales Department > Data folder. On the
Administration page, click Folders and navigate to the Sales Department > Data folder to
confirm that the library and tables are found there. There are libraries, tables, and cubes already
registered that will appear in addition to what was just added.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-12 Lesson 3 Data Management Tasks
Practice
Libref ordetail
Engine BASE
Windows Linux
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Managing Data 3-13
d. Scroll down in the list to see that the path is selected and click Save.
Windows
Linux
e. On the Customer Orders ordetail properties page, click the Assigned SAS Servers tab.
Click Edit (the pencil) on the right.
f. Select SASApp and click Save.
g. On the Customer Orders ordetail properties page, click the Tables tab to register tables in
the Customer Orders ordetail library. Click Add, , on the right to register the following
tables in the same folder as the library:
CUSTOMER, ORDERS, ORDER_ITEM, PRICE_LIST, PRODUCT_LIST
h. Verify that the location is the same location as the library. Select the tables and click OK.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-14 Lesson 3 Data Management Tasks
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Solutions 3-15
3.2 Solutions
Solutions to Exercises
1. Registering a SAS Library and Tables
Using SAS Environment Manager Administration, in this practice you register a SAS library and
tables with the following characteristics:
Libref ordetail
Engine BASE
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-16 Lesson 3 Data Management Tasks
b. Enter the name, location, type, and libref using the information above.
c. Click Add (the plus sign) to specify a path that is not in the path list and enter the Windows
or Linux path based on the environment that you are working with.
Windows Linux
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Solutions 3-17
d. Scroll down in the list to see that the path is selected and click Save.
Windows
Linux
e. On the Customer Orders ordetail properties page, click the Assigned SAS Servers tab.
Click Edit (the pencil) on the right.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-18 Lesson 3 Data Management Tasks
g. On the Customer Orders ordetail properties page, click the Tables tab to register tables in
the Customer Orders ordetail library. Click Add, , on the right to register the following
tables in the same folder as the library:
CUSTOMER, ORDERS, ORDER_ITEM, PRICE_LIST, PRODUCT_LIST
h. Verify that the location is the same location as the library. Select the tables and click OK.
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Solutions 3-19
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-20 Lesson 3 Data Management Tasks
Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.