1 / 75

Chapter 2: Working with Data in a Project

Chapter 2: Working with Data in a Project. Chapter 2: Working with Data in a Project. Objectives. State the definition of a SAS data set. State how data is stored in a SAS data set. Common Data Formats.

ahooper
Download Presentation

Chapter 2: Working with Data in a Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 2: Working with Data in a Project

  2. Chapter 2: Working with Data in a Project

  3. Objectives • State the definition of a SAS data set. • State how data is stored in a SAS data set.

  4. Common Data Formats • SAS Enterprise Guide can read and use data from a variety of different formats including the following: • SAS data sets • Microsoft Excel and Access • DBMS tables • Text files • JMP • HTML • SPSS

  5. 2.01 Multiple Answer Poll • Which types of data do you work with? • Microsoft Excel • Microsoft Access • DBMS tables (such as Oracle or DB2) • SAS data sets • Text files (delimited files) • Other

  6. SAS Data Set A SASdata set (or table) is a rectangular table of rows and columns. Rows(observations) Columns (variables)

  7. SAS Data Set • All columns must have a name, type, and length. • It is recommended that column names also • start with a letter or underscore • include only letters, underscores, and numbers. Names can be 1 to 32 characters long.

  8. SAS Data Set A column’s type is either character (string) or numeric. The type plays a role in determining the length. Charactervalues are1 to 32,767characters(bytes) long. Numeric values are 8 bytesof floating point storage: Numeric Currency Date (days from 01JAN1960) Time (seconds from midnight)

  9. SAS Data Set A format is used to control how values are displayed. Formats do not affect how values are stored. Format: DOLLAR Width: 10 Decimal Places: 2 Stored value: 234.60 Format: DATE Width: 9 Stored value: 16497

  10. Formats

  11. 2.02 Multiple Choice Poll • Which of the following variable attributes is not required? • Name • Type • Length • Format

  12. 2.02 Multiple Choice Poll – Correct Answer • Which of the following variable attributes is not required? • Name • Type • Length • Format

  13. SAS Data Set Properties Viewing a data set’s properties enables you to examine the data set and column attributes.

  14. 2.03 Multiple Choice Poll • Open the employee_organization data set. Click the Properties button on the toolbar and select Columns. • What is the length of the variable Job_Title? • 8 • 9 • 25 • 40

  15. 2.03 Multiple Choice Poll – Correct Answer • Open the employee_organization data set. Click the Properties button on the toolbar and select Columns. • What is the length of the variable Job_Title? • 8 • 9 • 25 • 40

  16. Missing Values . • If a data value is not present for a column in a particular row, it is considered missing. • A missing character value is displayed as a blank. • A missing numeric value is displayed as a period or dot.

  17. Chapter 2: Working with Data in a Project

  18. Objectives • Import a Microsoft Excel spreadsheet and create a SAS data set. • Import a fixed-width text file and create a SAS data set. • View the properties of the data.

  19. Business Scenario Orion maintains a Microsoft Excel file named products and a fixed-width text file named orders.To use these data sources in SAS Enterprise Guide, they must be imported into SAS data sets.

  20. Adding Data to a Project When a SAS data set is added to a project, SAS Enterprise Guide is able to read and open the data immediately. A shortcut to the data is added to the project.

  21. 2.04 Quiz Select File Open  Data… and navigate to the location of the course data if necessary. What happens when you open the products Excel file?

  22. 2.04 Quiz – Correct Answer Select File Open  Data… and navigate to the location of the course data if necessary. What happens when you open the products Excel file? The Import Data task automatically opens.

  23. Importing Data Not in a SAS Data Set The Import Data wizard can be used to read text, HTML, or PC-based data files (including Microsoft Excel and Microsoft Access) and to create SAS data sets.

  24. Step 1: Specify Data Verify the fileto be imported. Change the name andstorage location for theoutput SAS data set. The first step is to confirm the source data and designate the output SAS data set name and storage location.

  25. Step 2: Select Data Source When you read from structured data such as Microsoft Excel or Access, choose the data to be read and indicate whether the first row contains field names.

  26. Step 2: Select Data Source When you read from non-structured data such as a text file, choose the text format and indicate how the columns should be split.

  27. 2.05 Multiple Answer Poll • If the Rename columns to comply with SAS naming conventions. option is selected, which column headings would be modified in the imported data set? • Product_Category • Product Name • Discount% • Supplier-Country

  28. 2.05 Multiple Answer Poll – Correct Answers • If the Rename columns to comply with SAS naming conventions. option is selected, which column headings would be modified in the imported data set? • Product_Category • Product Name • Discount% • Supplier-Country • Spaces and special symbols are replaced with an underscore.

  29. Step 3: Define Field Attributes Set column attributes for columns included in the imported SAS data set.

  30. Step 4: Advanced Options Select any applicable advanced options.

  31. Import Data Results The new SAS data set is created and accessible via the Project Tree or Process Flow window.

  32. Updating Results Use Modify Task to reopenthe Import Data wizardand make changes. Use the buttonto refresh theoutput data set. The Import Data wizard can be rerun or modified from the Output Data tab.

  33. Using the Import Data Task This demonstration illustrates how import a Microsoft Excel and fixed-width text file to create SAS data sets.

  34. Setup for the Quiz (Live Web Only) Import the Products Excel file and create a SAS data set: Create a new project. Add the Products Excel file. (Select File Open  Data….) In step 1, verify that the output SAS data set is Products. In step 2, verify that the ProductList worksheet is highlighted and that First row of range contains field names is selected. Accept the default settings in step 3 and 4. Select Finish to create the new SAS data set.

  35. 2.06 Quiz What do you select to make a change in the Import Data task, such as change the name of the first variable?

  36. 2.06 Quiz – Correct Answer What do you select to make a change in the Import Data task, such as change the name of the first variable? Modify Task

  37. Using the Import Data Task (continued) This demonstration illustrates how import a Microsoft Excel and fixed-width text file to create SAS data sets.

  38. Exercise This exercise reinforces the concepts discussed previously.

  39. Chapter 2: Working with Data in a Project

  40. Objectives • Identify remote data sources. • Access a remote server. • Add remote data to a project.

  41. Business Scenario Orion Star wants to use SAS Enterprise Guide to access a DBMS table on a remote server. The table includes information about customer orders.

  42. Transparent Access to Remote Data z/OSMainframe UNIX WindowsServer Local User

More Related