Presentation is loading. Please wait.

Presentation is loading. Please wait.

11 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Importing Text Files 2.4 Editing Tables in the.

Similar presentations


Presentation on theme: "11 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Importing Text Files 2.4 Editing Tables in the."— Presentation transcript:

1 11 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Importing Text Files 2.4 Editing Tables in the Data Grid

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

3 3 Common Data Formats SAS Enterprise Guide can read and use data from a variety of different formats. 3 Microsoft Excel spreadsheets JMP, SPSS, and Stata files HTML tables ODBC- compliant data OLE DB provider’s files Microsoft Access tables Fixed-width and delimited text files SAS data sets

4 44

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

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

7 7 SAS Data Set All columns must have a name, type, and length. 7 Names can be 1 to 32 characters long.

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

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

10 10 Formats 10

11 11

12 12 2.02 Multiple Choice Poll Which of the following variable attributes is not required? a.Name b.Type c.Length d.Format 12

13 13 2.02 Multiple Choice Poll – Correct Answer Which of the following variable attributes is not required? a.Name b.Type c.Length d.Format 13

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

15 15

16 16 2.03 Multiple Choice Poll Right-click on the employee_organization data set in the project and select Properties  Columns. What is the length of the variable Job_Title ? a.8 b.9 c.25 d.40 16

17 17 2.03 Multiple Choice Poll – Correct Answer Right-click on the employee_organization data set in the project and select Properties  Columns. What is the length of the variable Job_Title ? a.8 b.9 c.25 d.40 17

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

19 19 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Importing Text Files 2.4 Editing Tables in the Data Grid

20 20 Objectives Add a local Excel spreadsheet to the project. View the properties of the data. 20

21 21 Business Scenario 21 Orion maintains a list of products in a Microsoft Excel file named products.xlsx. To use this data in SAS Enterprise Guide, it must be imported into a SAS data set.

22 22 Importing Structured Data Not from SAS The Import Data wizard enables you to create SAS data sets from text, HTML, or PC-based data files (including Microsoft Excel and Microsoft Access). 22

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

24 24 Step 2: Select Data Source Choose the data to be read and indicate whether the first row contains column names. 24

25 25

26 26 2.04 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? a. Product_Category b. Product Name c. Discount% d. Supplier-Country 26

27 27 2.04 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? a. Product_Category b. Product Name c. Discount% d. Supplier-Country Spaces and special symbols will be replaced with an underscore. 27

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

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

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

31 31 Updating Results The Import Data wizard can be rerun or modified from the Output Data tab. 31 Use the button to refresh the output data set. Use Modify Task to reopen the Import Data wizard and make changes.

32 32 Adding a Local Excel Spreadsheet to the Project This demonstration illustrates how to add a local Excel spreadsheet to the project. 32

33 33 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Importing Text Files 2.4 Editing Tables in the Data Grid

34 34 Objectives Use the Import Data task to import a text file into a project as a SAS data set. 34

35 35 Business Scenario Orion Star has a fixed-width text file named orders. To use the data in the text file, it must be imported into a SAS data set. 35

36 36 Business Scenario The SAS data set must have the following attributes: Name the data set orders. Exclude the Employee_ID column. Assign column names based on the first row of the text file. Format Profit as a currency value. Format Discount with a percent sign. 36

37 37 Import Data Wizard To your computer, a text file is only strings of characters. SAS Enterprise Guide requires that the data be structured with rows and columns (observations and variables). 37

38 38 Import Data Wizard The Import Data wizard can be used to convert a text file into a customized SAS data set. 38

39 39

40 40 2.07 Quiz What do you need to tell SAS Enterprise Guide about this file in order to provide the necessary structure to create a SAS data set? 40

41 41 2.07 Quiz – Correct Answer What do you need to tell SAS Enterprise Guide about this file in order to provide the necessary structure to create a SAS data set? where each column is located in the text file which columns to read in the name of each column whether the first row contains column headings the type of data in each column –character –numeric (currency, date, time) how much storage space to allocate how to read and format the data values 41

42 42 Adding Data from a Fixed-Width Text File This demonstration illustrates using the Import Data task to read a text file. 42

43 43

44 44 Exercise This exercise reinforces the concepts discussed previously. 44

45 45

46 46 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Importing Text Files 2.4 Editing Tables in the Data Grid

47 47 Objectives Use the Data Grid to delete columns and rows. Use the Data Grid to modify column attributes and sort a data set. Use the Expression Builder to create columns. 47

48 48 Business Scenario A data manager at Orion Star wants to permanently modify the orders data set to include a column named Total_Invoice that represents the sum of Total_Retail_Price and Shipping. 48

49 49 Data Grid When you add a data set to a project, the Data Grid’s default behavior is to display the data automatically in read-only mode. Actions available in the Data Grid in read-only mode include the following: browsing SAS data sets and other data sources resizing row and column widths for better viewing copying rows and columns to paste into a new or existing SAS data set hiding rows and columns from view holding rows and columns while scrolling 49

50 50 Data Grid Actions available in the Data Grid in update mode are limited to SAS data sets and include all actions available in read-only mode, as well as the ability to do the following: edit data values change the names of columns apply labels and formats to columns delete rows and columns sort by multiple columns in ascending or descending order create new columns and add rows 50 When you modify a data set through the Data Grid, you change the actual data values in the data set.

51 51 Column Properties Right-click on a column and select Properties to modify the column name, label, type, and format. 51

52 52 Insert a Column To permanently add a column, right-click on the existing column where the new column should be added and select Insert Column…. 52

53 53 Expression Builder: Creating a Column Use the Advanced Expression Builder to provide an expression to build a new column. 53

54 54 Data Grid: Results The additional column will be added and saved within the data source. 54


Download ppt "11 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Importing Text Files 2.4 Editing Tables in the."

Similar presentations


Ads by Google