We'll now turn our attention to creating data items and applying filters. Here we'll illustrate how to create new data items such as distinct counts and custom categories in Visual Analytics. To get started, we'll click on our main menu and select explore and visualize. This should be familiar by now. This is SAS Visual Analytics. From the main menu of explore and visualize, we'll click on all reports and then we'll navigate to courses, YVA185, basics, demo marketing. Inside of that folder, you should see VA1-Demo3.3a. We'll double-click on that report to open it. In the top left corner of the screen, we'll click on page 3. Now we want to enter editing mode. Remember, that's the pencil in the top left corner here. Now we're in editing mode and we get our Data pane. We get out panes in the left and right-hand side. Beginning with the Data pane, let's click on that. I'm going to collapse these for a moment. You'll see the aggregated measure group here at the bottom, and inside of there is a number of orders. If we right-click on that and select Edit, you'll see how this data item is created. What we're doing here for a number of orders is getting the order IDs, and then we're selecting the distinct order IDs from that table, and that'll give us a count of the number of orders. We'll cancel this one. Then in the Measure group, let's look at Customer Age, and we'll do the same thing. Right-click Edit. Now you can see that this one is a little more complex. This calculation looks at the date that we're at now and subtracts the customer's birth date and then divides by the number of days in a year to get the customer age. Again, calculated item building this formula or this calculation within the Data pane. I'll cancel that one. Then one more here in the Category group. Let's look at Customer Age Group, right-click Edit. Here you'll see a little more complex calculation as well as some if-then logic as well. If the customer age is less than or equal to 29, and notice, we're using Customer Age, which we just looked at. We can use calculated data items that we've created in other calculations as well. If the customer is less than or equal to 29, that will return 29 and below as the Customer Age Group. Now we'll continue on down that path until we capture all of the various age groups up to 75 and above. Let's cancel. We're not going to make any changes in here for now. Now, what we'll do is create a new distinct count data item. In the Category group, let's find Customer ID, which is here. We'll right-click on that and we will select New calculation. In the name field, let's enter Number of Customers. For the type, let's make sure it says distinct count. Notice you can do a count, number missing, or distinct count. We want to know how many distinct customers we have in this customers clean data table, so we'll use distinct count. We'll click Okay. You'll notice that our new calculated item here is placed into the aggregated measure group number of customers inside of aggregated measure. Okay, so let's use our new data item here. Number of items is already selected. You can see the different highlight color here. Let's also select Number of Orders. On a Mac, you hold down the Command key. On a PC, I believe it'll be the Control key. Click on another item here. Now I've got number of customers and number of orders. Then let's find order type, which would be up here in the categories group. Now you can see I have all three of those selected. What I want to do is drag those. I'm going to grab those with my mouse and drag to the left side of the report. You'll see here where it can create an auto chart for us. I'm going to drop that here. That auto chart is going to determine for us the best way to display the data based on the selections that we made. You'll see in this new auto chart report, and I'll expand it here for clarity. There we go. You'll see here that the total profit is lower in Internet and Catalog channels because there are fewer customers that place orders through those channels, and there are also significantly lower orders placed through those channels. Let's restore the size on that. Then in the right-hand pane, let's click on Options. For the name field, let's type in customers and orders by order type. That's creating a new data item. Now let's duplicate a data item and then modify some of its properties. Returning to the left pane, let's go back to Data. In the Measure group, let's find profit. Right-click on it and duplicate. Now you'll notice we have profit, but we also have profit and then a one in parentheses. Next to our new data item, Profit 1, we'll click on this double carrot, which will allow us to do some basic editing here, edit the properties of our new data item. For this one under aggregation instead of sum, let's select Average and then let's change the name to average profits. I'm just going to delete the one in the parentheses and I'm going to call this average profit. Press Enter to save. Now you can see we still have our profit measure, but now we have an average profit measure as well. Now let's use our new data item to modify the chart that was on the right-hand side of our report. Notice it used profit by order type and continent. We want to make that use average profit, our new data item instead. What we'll do in the right pane, we'll click on Roles. Make sure this chart is selected. Click on Roles and you will notice here average profits by order type and continent. But in the measure, we currently have profit. What you can do is expand your data pane on the left-hand side. You'll have both the Roles and the Data pane open. We can drag average profit, our new data item, and drop it on top of profit here, and you'll see that it gets replaced with our new average profit measure. Give that just a moment to load the chart. Our chart is now updated using average profit instead of the total profit. Our next demonstration involves applying filters in Visual Analytics. To get started, make sure you're in Explore and Visualize, navigate to Courses, YVA185, Basics and Demos Marketing. Inside that folder you should see VA1-Demo 3.3b, we'll double-click on that report to open it. In the upper left-hand corner, let's click on "Page 4." Now we'll also enter editing mode to get access to all of our tools. In the left-hand pane, let's click "Data." Then in the Category group at the top, next to State Name, let's click on "Edit Properties." Then where it has classification, which is currently set to category, let's change that to geography. Now for the geography data field, let's verify that geographic name or code lookup is selected. It is on my report, so we're good there. Then for the name or code context, let's select "US State Names." You'll see the map update here to 19 percent mapped. If you want to view the list of unmapped values, you can scroll down on the right-hand side here, and you'll see five unmapped values. Let's click on "Okay." Then you'll see we now have a new group here called geography. We still have category, we still have measure, we still have aggregated measure, but now we also have geography that has our new state name in it. Now, in the Data pane we have Postal Code, let's edit properties on that by clicking these double carets. For Classification, let's change this also to geography. In the geography data field, let's verify geographic name or code lookup, which again, is selected in the report already. Then for the name or code context, let's select "US Zip Codes." We'll see 57 percent mapped here. Again, you can scroll down and see unmapped values. Let's click "Okay" here as well. Now postal code also is moved to the geography category or group. Next we'll create a new data item. In the top of our Data pane here, there's a button, New Data Item, let's click on that. Let's select "Hierarchy." We'll get a new window pop up here for new hierarchy in the name, let's enter US hierarchy. Then we'll double-click on "State Name" and "Postal Code," which will move those two items to the right-hand side. Then we'll click "Okay." Now, you'll see another category here called hierarchy and has our new US hierarchy data item that we just created. Now, we can work on adding a data source filter. In this same data pane that we've been working in, at the top, we have an icon here for actions. Let's click on that and then we'll select Apply Data Filter. On the left-hand side makes sure that data items is selected. You'll notice an underline below that tab. Then let's expand the character group. Now, we'll select Customer Country. Then in the conditions area below that, we're going to double-click on this to see if we can see this. I'm going to have to just hover over these to read them. We're looking for Customer Country in x, right here, Customer Country in x. I'm going to double-click on that. Notice that we'll add it to our expression area on the right-hand side. Now, in the expression area, you can click where it says none selected and then in the select data values window that pops up, you can double-click on United States to move it from the available items to the selected items. If you don't see, it, can also search for my slid off the screen there. I'll double-click on the United States. Now that moves to the selected items and I'll click Okay. Now, it says Customer Country in the United States. Now, notice at the bottom here, our total observations are 951,669, but the customers that are in the United States are 232,258. That's our filter being applied. Right now, we can click Okay here and then let's create a Geo Map in the left pane. Let's go to Objects, then we'll find under Geo Maps, can find Geo coordinate. We'll drag that onto our report. Now, we have to assign data for this map to populate information. On the right-hand side, let's select Roles. For the Geography role, let's click on Add then US Hierarchy. For the Size role, let's click Add and select Frequency. That will change the size of each bubble on the states, and then for the color role, click on Add, and let's select Profit. A little bit more editing to our Geo Map here. On the right pane, let's click on "Options". Let's change the name to Profit by Location. Then in the Coordinate group, let's verify this scatter is selected, which it is here. Then in the initial marker shape, let's pick Diamond. For marker size, let's change that to 30 percent. Here we go. Notice we're just changing shapes, changing the way information is displayed in our report here. Finally, in the legend group at the bottom, let's expand that. Then in the placement field, let's pick the middle right side, so our legend will show up over here for our report. It looks good. Now what the hierarchy does for us, let me close this Options pane. What the hierarchy does is I can drill into one of these markers now, so I'll pick on Texas here. I double-click on that Texas marker, you'll see we can zoom in to the state of Texas. Now I get markers for lots of different cities or zip codes within the state of Texas. I also can click on this location icon in the top left corner, and I can search. I might want to search for Austin, Texas, and then if I double-click on that first value that's found because that's the one that I want, and you'll see we get a marker here for Austin, Texas with lots of information about the zip codes that are found within Austin. Now in that box that shows up in the top left, we can select geographic selection. Then let's make sure distance is selected in the type field, and miles is selected in the unit field. For the distance, let's enter 50. Then click on the "Draw Selection" button. Now we just drew a selection circle around all of the customers within a 50 mile radius of Austin, Texas. Now I can right-click inside that selection, that circle, and I can choose new filter from selection, include only the selection. Then in the right pane, you can click on the "Filters" item, and you can see that we're filtering on postal code here, and it's just those zip codes within a 50 mile radius of Austin, Texas. You can save your report, and you can close this portion of the demo.