Recently, I came across some happiness data from The World Happiness Report that I wanted to build some visualizations around. To make it more “fun” I decided I would use custom faces to represent the country’s overall happiness score.
Before diving into how we set this up in SAS Visual Analytics. I’m going to show you how I created the face icons using PowerPoint.
From the top menu, we’ll select the Insert item and then select Icons.
Then we’ll select the three faces we want to use and select the Insert button.
Next, we’ll change the image properties, such as fill, to get the image the way we want. In this case, I changed the fill to a red color. Then we’ll save the image as a picture (right click on the image to get the menu).
Because we want a clear background behind our image, we’ll choose PNG Portable Network Graphics Format (.png) for the Save as type.
We’ll repeat all the same steps to create the other two faces (happyface and mehface).
To use images, you’ll need to either choose Geo Coordinate or Geo region-coordinate object. In the example above, I used Geo region-coordinate.
Once you’ve added your object to the report (under COORDINATE- COUNTRY if you are using a Geo Region-Coordinate object), you’ll assign your geography data item (in this example – Country) to the Geography role. If you want the size of the icon to represent a variable you can add that to the size role. In this example, the larger the face the greater the healthy life expectancy is. Next, you’ll add the variable you want to use to determine which image to display as the color role. In this example: If the countries happiness score is < 5 I want a sad face to display, if the country’s happiness score is between 5 and 6 I want a “meh” face and if the country’s happiness score is greater than 6 I want a happy face to display. So, I’ll add score as my color role.
Next, you’ll add Display Rules to the geomap. This is where we’ll define criteria for which image we want displayed.
From the left pane, I’ll select Rules, then New Rule and choose Score under Coordinate-Country.
Here, we’ll add our criteria when score is greater than 6. Then we’ll select the Style icon.
Next, well select the Icon tab, Custom button and select Upload Local Image (note: SAS does provide some basic icons you can use if you don’t want to create your own).
We’ll choose the happyface.png file that we created in PowerPoint, then select the Ok button.
We’ll select Ok again to exit out of the New Display Rule window and then we’ll create new rules for the other two faces.
Here we have all the rules displayed in the Rules screen.
Now our report displays custom icons based on our criteria with the size represented by healthy life expectancy. I hope you found this helpful and have fun creating custom icons!
To find more information about this report refer to the Analyzing happiness data in 2020 blog post.
Attribution:
Helliwell, John F., Richard Layard, Jeffrey Sachs, and Jan-Emmanuel De Neve, eds. 2020. World Happiness Report 2020. New York: Sustainable Development Solutions Network
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.