0% found this document useful (0 votes)
5 views20 pages

LWSPAGS903

Lesson 3 focuses on data management within SAS, detailing how to manage data from various sources, including libraries and tables. It explains the process of registering SAS libraries and tables in the SAS Environment Manager, emphasizing the importance of metadata for data access and security. The lesson includes practical exercises for registering a SAS library and its associated tables.

Uploaded by

Gilbert Prevost
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views20 pages

LWSPAGS903

Lesson 3 focuses on data management within SAS, detailing how to manage data from various sources, including libraries and tables. It explains the process of registering SAS libraries and tables in the SAS Environment Manager, emphasizing the importance of metadata for data access and security. The lesson includes practical exercises for registering a SAS library and its associated tables.

Uploaded by

Gilbert Prevost
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Lesson 3 Data Management

Tasks
3.1 Managing Data......................................................................................................................... 3-3
Demonstration: Registering SAS Library and Table Metadata in SAS Environment
Manager ....................................................................................................... 3-6
Practice ................................................................................................................................. 3-12

3.2 Solutions ................................................................................................................................ 3-15


Solutions to Exercises .......................................................................................................... 3-15
3-2 Lesson 3 Data Management Tasks

Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Managing Data 3-3

3.1 Managing Data

Access to Many Types of Data

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 is able to access data in many different formats, including

• SAS data sets (tables)


• Relational databases systems (SQL Server, Oracle, DB2, Teradata, and so on)
• External files
• ODBC data sources
• Hadoop
• XML.

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

SAS Metadata Libraries and Tables

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:

• location or connection information


• data type

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

Default, assigned as needed applications

Pre-assigned metadata

Program Code programs

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.

There are three ways in which libraries are assigned:

• 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

Registering SAS Library and Table Metadata in SAS


Environment Manager
This demonstration illustrates how to use SAS Environment Manager to register a SAS library and
tables in the metadata.
Note: For the current release of SAS Environment Manager, you can browse any type of library
that has been defined in SAS metadata. You can create and edit definitions for Base SAS
libraries and SAS LASR Analytic libraries.
1. Sign in to SAS Environment Manager as Ahmed using the Student1 password.
2. Click the Administration tab. On the Administration page, click Libraries.

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.

7. For Type, select SAS Base Library.

Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-8 Lesson 3 Data Management Tasks

8. Enter ship1 as the libref. Keep Engine as BASE.


Note: A libref is a nickname or short reference to the physical location of the data. It is a best
practice to use unique librefs in the metadata. Uniqueness of librefs is not enforced.

9. Scroll down and select the box next to the path of the physical storage of the data.

For Linux /opt/sas/Workshop/OrionStar/orgold

Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Managing Data 3-9

For Windows D: \Workshop\OrionStar\orgold

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

14. Click the Register Tables toolbar button +.

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

16. Click Close.

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

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:

Library Type SAS Base Library

Name Customer orders ordetail

Folder location /Orion Star/Marketing Department/Data

Libref ordetail

Engine BASE

Path • On the Linux server: /opt/sas/Workshop/OrionStar/ordetail


specification • On the Windows server: D:\Workshop\OrionStar\ordetail
Note: You might need to add the path to the existing list.

Assigned SAS SASApp


Servers

a. On the Libraries page, click New Library.


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.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

The customer table has scrolled off the list above.


i. When finished, click Close.

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:

Library Type SAS Base Library

Name Customer orders ordetail

Folder location /Orion Star/Marketing Department/Data

Libref ordetail

Engine BASE

• On the Linux server: /opt/sas /Workshop/OrionStar/ordetail


Path
specification • On the Windows server: D:\Workshop\OrionStar\ordetail
Note: You might need to add the path to the existing list.

Assigned SAS SASApp


Servers

a. On the Libraries page, click New Library.

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.

f. Select SASApp and click Save.

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.

The customer table has scrolled off the list above.

Copyright © 2021, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Solutions 3-19

i. When finished, click Close.

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.

You might also like