exploring sas visual analytics capabilities to go from fat ... · macronutrient intake levels to...

22
1 Exploring SAS ® Visual Analytics capabilities to go from Fat to Fit! Viraj Kumbhakarna, MUFG Union Bank, San Francisco, CA ABSTRACT In this paper we explore capabilities of SAS ® Visual Analytics for analyzing personal health data automatically captured everyday using Fitbit ® wearable technology device and Lose It! ® mobile nutrition logging digital health applications to create personalized health dashboard. Health data analyzed consists of daily macronutrient intake, calories burned, number of steps, floors climbed, active minutes, sleep analysis and other vital statistics captured automatically every day. Goal is to utilize analytical capabilities of SAS ® Visual Analytics to achieve desired weight loss by closely monitoring daily nutrient intake and keeping within benchmark limits specified by the Food and Nutrition Information Center (FNIC). The objective of this paper is to explore analytical and reporting functions of SAS ® Visual Analytics to analyze macronutrient health data, compare against benchmark values of daily nutrient intake recommendations specified by the Dietary Reference Intake (DRI) guidelines published by institute of Medicine (IOM) and determine time to achieve desired weight loss. We utilize SAS ® Visual Analytics to gain an insight into health data, explore hidden relationships in various foods and nutrients, explore relationships within the data and use forecasting algorithm to estimate time required to achieve desired weight loss. We will explore the following features of SAS ® Visual Analytics software: 1. Preparing data: Using SAS ® to extract source data, using explore data feature to gain insight into health data, managing data, etc. 2. Designing reports using SAS ® Visual Analytics: Use SAS ® Visual Analytics designer to add data source, work with data items, hierarchies and calculated data items to design reports. 3. SAS ® Visual Analytics dashboards: Working with visualizations, filters, ranking data to create bar/line charts, heat /tree maps, correlations matrices, adding fit line/forecasting to existing visualization, forecast measures etc. In conclusion, the goal is to utilize analytical capabilities of SAS ® Visual Analytics, explore various data visualization features to create health dashboards to achieve desired weight loss. INTRODUCTION An endeavor is made with this paper to not only explore various functionalities and analytical capabilities of using SAS ® Visual Analytics but also to scientifically apply the analytical and forecasting capabilities of SAS ® to create detailed health reports and dashboards by tracking daily macronutrient intake to be within recommended daily macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a healthy individual to keep within limits of suggested dietary intake on the U.S. Department of Health & Human Services. Benchmark daily nutrient intake levels were established by referring the macronutrient intake requirements established from the above study for a healthy individual. Further, the daily intake of the macronutrients was tracked using two applications a wearable technology Fitbit device Charge HR and iPhone health monitoring application Lose It! Fitbit Inc. is a company headquartered in San Francisco, California founded and managed by James Park and Eric Friedman, the company is known for its products of the same name, which are activity trackers, wireless-enabled wearable devices that measure data such as the number of steps walked, quality of sleep and other personal metrics. The Fitbit Charge HR wearable technology device was utilized in this project to track the daily activity levels and other vital on a daily basis. The user’s activity data automatically captured via the Fitbit Charge HR device is available on the Fitbit website for use. Data was downloaded from the website in csv (comma separated value) file format and was further converted to SAS datasets which were used in further analysis and reporting. Lose It! is the industry-leading digital health and fitness platform that is centered on the proven principles of calorie tracking and community support for healthy, sustainable weight loss. Members track their daily food intake and fitness activity, and can create goals, start or join community activities and competitive challenges, connect activity trackers, access coaches, and more. Lose It! seamlessly integrates with top health and fitness brands, such as Jawbone, Fitbit, Nike, Misfit, Withings, Strava, MapMyFitness, Apple Health and RunKeeper. The Lose It! experience gives members the ability to share data through wearable activity trackers, Bluetooth devices, and a variety of connected mobile apps to help them achieve powerful, personalized result. Data captured using Lose It! was also downloaded from the website in csv (comma separated value) format and was further converted into SAS datasets which will be used for analysis and reporting. The mission of the U.S. Department of Health & Human Services (HHS) is to enhance and protect the health and well-being of all Americans. They fulfill that mission by providing for effective health and human services and fostering

Upload: others

Post on 23-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

1

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

Viraj Kumbhakarna, MUFG Union Bank, San Francisco, CA

ABSTRACT

In this paper we explore capabilities of SAS® Visual Analytics for analyzing personal health data automatically

captured everyday using Fitbit® wearable technology device and Lose It!

® mobile nutrition logging digital health

applications to create personalized health dashboard. Health data analyzed consists of daily macronutrient intake, calories burned, number of steps, floors climbed, active minutes, sleep analysis and other vital statistics captured automatically every day. Goal is to utilize analytical capabilities of SAS

® Visual Analytics to achieve desired weight

loss by closely monitoring daily nutrient intake and keeping within benchmark limits specified by the Food and Nutrition Information Center (FNIC).

The objective of this paper is to explore analytical and reporting functions of SAS® Visual Analytics to analyze

macronutrient health data, compare against benchmark values of daily nutrient intake recommendations specified by the Dietary Reference Intake (DRI) guidelines published by institute of Medicine (IOM) and determine time to achieve desired weight loss. We utilize SAS

® Visual Analytics to gain an insight into health data, explore hidden relationships

in various foods and nutrients, explore relationships within the data and use forecasting algorithm to estimate time required to achieve desired weight loss. We will explore the following features of SAS

® Visual Analytics software:

1. Preparing data: Using SAS® to extract source data, using explore data feature to gain insight into health

data, managing data, etc. 2. Designing reports using SAS

® Visual Analytics: Use SAS

® Visual Analytics designer to add data source,

work with data items, hierarchies and calculated data items to design reports. 3. SAS

® Visual Analytics dashboards: Working with visualizations, filters, ranking data to create bar/line charts,

heat /tree maps, correlations matrices, adding fit line/forecasting to existing visualization, forecast measures etc.

In conclusion, the goal is to utilize analytical capabilities of SAS® Visual Analytics, explore various data visualization

features to create health dashboards to achieve desired weight loss.

INTRODUCTION

An endeavor is made with this paper to not only explore various functionalities and analytical capabilities of using SAS

® Visual Analytics but also to scientifically apply the analytical and forecasting capabilities of SAS

® to create

detailed health reports and dashboards by tracking daily macronutrient intake to be within recommended daily macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a healthy individual to keep within limits of suggested dietary intake on the U.S. Department of Health & Human Services. Benchmark daily nutrient intake levels were established by referring the macronutrient intake requirements established from the above study for a healthy individual. Further, the daily intake of the macronutrients was tracked using two applications – a wearable technology Fitbit device Charge HR and iPhone health monitoring application Lose It!

Fitbit Inc. is a company headquartered in San Francisco, California founded and managed by James Park and Eric Friedman, the company is known for its products of the same name, which are activity trackers, wireless-enabled wearable devices that measure data such as the number of steps walked, quality of sleep and other personal metrics. The Fitbit Charge HR wearable technology device was utilized in this project to track the daily activity levels and other vital on a daily basis. The user’s activity data automatically captured via the Fitbit Charge HR device is available on the Fitbit website for use. Data was downloaded from the website in csv (comma separated value) file format and was further converted to SAS datasets which were used in further analysis and reporting.

Lose It! is the industry-leading digital health and fitness platform that is centered on the proven principles of calorie tracking and community support for healthy, sustainable weight loss. Members track their daily food intake and fitness activity, and can create goals, start or join community activities and competitive challenges, connect activity trackers, access coaches, and more. Lose It! seamlessly integrates with top health and fitness brands, such as Jawbone, Fitbit, Nike, Misfit, Withings, Strava, MapMyFitness, Apple Health and RunKeeper. The Lose It! experience gives members the ability to share data through wearable activity trackers, Bluetooth devices, and a variety of connected mobile apps to help them achieve powerful, personalized result. Data captured using Lose It! was also downloaded from the website in csv (comma separated value) format and was further converted into SAS datasets which will be used for analysis and reporting.

The mission of the U.S. Department of Health & Human Services (HHS) is to enhance and protect the health and well-being of all Americans. They fulfill that mission by providing for effective health and human services and fostering

Page 2: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

2

advances in medicine, public health, and social services. The Food and Nutrition Board issues documents that are issued by the Institute of Medicine, National Academy of Sciences. The Food and Nutrition Board addresses issues of safety, quality, and adequacy of the food supply; establishes principles and guidelines of adequate dietary intake; and renders authoritative judgments on the relationships among food intake, nutrition, and health. The Dietary Reference Intakes (DRIs) are developed and published by the Institute of Medicine (IOM). The DRIs represent the most current scientific knowledge on nutrient needs of healthy populations. Please note that individual requirements may be higher or lower than the DRIs.

DRI is the general term for a set of reference values used to plan and assess nutrient intakes of healthy people. These values, which vary by age and gender, include:

1. Recommended Dietary Allowance (RDA): average daily level of intake sufficient to meet the nutrient requirements of nearly all (97%-98%) healthy people.

2. Adequate Intake (AI): established when evidence is insufficient to develop an RDA and is set at a level assumed to ensure nutritional adequacy.

3. Tolerable Upper Intake Level (UL): maximum daily intake unlikely to cause adverse health effects.

DATA PREPARATION

In this section we will discuss using SAS® to extract source data, using explore data feature to gain insight into health

data, managing data. We will also discuss the data extraction process, the Extract Transform Load (ETL) operations performed to extract data from various data sources such as Fitbit, Lose It! and DRI benchmark data from U.S. Department of Health & Human Services website, transform the data from various formats into SAS datasets and load the data on the SAS Visual Analytics LASR server for further analysis and creating detailed reports on the SAS

®

Visual Analytics dashboard.

The following figure shows how files accessed from local PC, are transferred to the SAS Workspace Server, and then stored in an output table used in creating the SAS

® Visual Analytics dashboards.

Figure 1. Data extraction, ETL and loading on SAS LASR Analytic server

All input datasets from sources such as Fitbit, obtained from converting the sources files into SAS datasets are stored on local machine, these local data files, such as a spreadsheet, delimited text file, or SAS data set from local desktop, are then transferred as data to SAS LASR Analytic Server. This enables us to access data in the SAS Visual Analytics server for reporting without needing assistance from an administrator or information technology group.

Establish Dietary Reference Intakes (DRI) Benchmark

The exact daily nutrition requirements can be found from the U.S. Department of Health & Human Services (HHS)

website Dietary Reference Intake Calculator for Healthcare Professionals. The web based tool available at

above link can be used to calculate daily nutrient recommendations for dietary planning based on the Dietary Reference Intakes (DRIs). These represent the most current scientific knowledge on nutrient needs, developed by the National Academy of Science’s Institute of Medicine. Individual requirements may be higher or lower than the DRIs.

Page 3: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

3

Using the above tool the benchmark daily nutrient values for my individual daily dietary requirements were calculated as below:

Table 1 shows the daily caloric needs of an individual:

Table 1. Daily caloric needs for an individual

For a 31 years old male having a height of 5ft. 8 in. weighing 171 lbs. the daily dietary caloric needs are 2547 kcal/day. In order to determine your personal basal metabolic rate or BMR use the following formulae. BMR provides minimum amount of calories to be ingested for your body to perform its basic tasks, such as heart to beat, breathing, digesting, etc. This measurement can help you fine tune the calorie needs of your body using the Harris Benedict formula.

The woman's American measurement BMR equation is: (4.7 x your height in inches) + (4.35 x your weight in pounds) - (4.7 x your age in years). Add 655 to this total for the BMR.

The man's American measurement BMR equation is: (12.7 x your height in inches) + (6.23 x your weight in pounds) - (6.8 x your age in years). Add 66 to the total for the BMR.

The BMR equation in metrics for women is: (9.6 x your weight in kilograms) + (1.8 x your height in centimeters) - (4.7 x your age in years). Add 655 to the total to learn your BMR.

The BMR equation in metrics for men is: 66 + (13.7 x your weight in kilograms) + (5 x your height in centimeters) - (6.8 x your age in years). Add 66 to the total to learn your BMR.

In my case my daily calorie limit came out to be 1572.75 calories. If an individual intakes less calories than his estimated daily caloric needs then he is bound to lose weight. Please note, all the suggestions in this paper are only recommendations, it is seriously recommended to refer your own physician and doing your own research before making any change to your own diet. Recommended Dietary Allowance (DRA) corresponds to average daily dietary nutrient intake level sufficient to meet the nutrient requirement of nearly all (97 to 98 percent) healthy individuals in a particular life stage and gender group.

Table 2. Daily macronutrient Dietary Reference Intake (DRI) Benchmark

Page 4: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

4

Import Fitbit® and Lose It! application data

The weekly macronutrient data for a user was captured over time via the Lose It! ®

iPhone health and nutrition logging application. A data entry was made every day, upon every meal to capture the food and nutrition intake over time for the food items consumed since early 2010 onwards until present day. The iPhone Lose It!

® application has a large

database of foods where the nutrition information for most foods is automatically available. A user can enter the daily food items consumed for every one of his meals via the iPhone application or via the Lose it!

® website

(http://www.loseit.com/#Home). Please see below for a sample data entry on the day of 04/17/2015:

Figure 2. Lose It!® sample data entry for a daily nutrition intake

Please see above for a sample data entry for logging daily nutrition and food intake. The user enters the food items, and serving amounts for all foods consumed during each of his meals – lunch, snack, dinner and breakfast. The amount of calories for various foods are already available for most food items in the Lose It!

® database. There is also

ability to create custom foods on the Lose It! ®

application. Data is stored in weekly summary files and is available for download on the Lose It! website: http://www.loseit.com/#Insights:Weekly%20Summary%5EWeekly%20Summary.

The Lose It! ®

user’s weekly summary reports for all weeks for which data was entered were downloaded from the Lose It!

® website. SAS datasets were created from the raw csv (comma separated value) files. The lengths of the

variables in the csv were determined by finding out the maximum length from all the csv files and the datatype was assigned by examining whether the input variables are qualitative or quantitative variables. A macro code was developed using the infile statement to read in multiple weekly input csv files and create SAS datasets. A weekly_summary.sas7bdat SAS dataset was created by appending files for multiple weeks which will be further used in creation of the SAS Visual Analytics dashboards. Please see below for a sample csv macronutrient intake weekly summary file available from the Lose It!

® application website:

Page 5: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

5

Figure 3. Lose It!® sample weekly summary csv file

Fitbit®

activity trackers are wireless-enabled wearable technology devices that measure daily activity data such as the number of steps walked, quality of sleep, steps climbed, and other personal metrics of the users. One would typically wear the activity tracker at all times. The Fitbit

® Charge HR was utilized over the course of this project to

automatically track the daily activity level for the user over the period of three months from March-2015 to April-2015. The activity data was downloaded via the Fitbit

® website by logging for the particular user via the web site

https://www.fitbit.com/export/user/data in the form of csv files.

Figure 4. Fitbit® csv file

Fitbit®

activity data was processed in SAS to create separate SAS datasets by activities such as body weight and BMI SAS dataset, Food intake in calories dataset, activities dataset containing measures such as calories burned, steps climbed, distance traversed, floors climbed and activity levels. The csv files were converted into SAS datasets by determining the maximum lengths of variables to assign the lengths and the datatype whether a variable is character or numeric was determined by examining the variable values whether the variables are qualitative or quantitative measures. Please see below for a sample csv Fitbit

® input file:

Page 6: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

6

Figure 5. Fitbit® input sample activity data csv file

As a part of the data preparation process, above datasets derived from converting the raw csv file formats for the Lose It! and Fitbit applications were imported to the SAS

® Visual Analytics server and would be further used in

designing reports in SAS® Visual Analytics.

DESIGNING REPORTS USING SAS® VISUAL ANALYTICS

In this section, we will consider all activities involved right from importing the SAS® datasets and loading them on to

the SAS® Visual Analytics LASR server to creating calculated measures, creating hierarchies within the data and

designing reports using the SAS Visual Analytics Dashboards.

LOADING TABLES TO SAS® LASR ANALYTIC SERVER

In order to be able to create analytical reports, we need to import SAS data sets created during the data preparation step which are available on the SAS Application Server and load them to SAS LASR Analytic Server. LASR server consists of the new predefined server (the Public LASR Analytic Server) and the library (the Visual Analytics Public LASR library) and provides broad access and supports the new automated data loading feature to load the SAS datasets in memory. One of the most powerful benefits of SAS LASR Analytic Server is the ability to read data in parallel from a co-located data provider. In this configuration, the SAS LASR Analytic Server software is installed on the same hardware as the data provider. During installation, the SAS Deployment Wizard registers a library for SAS LASR Analytic Server. This library is available for use in the SAS Folders tree, and it is located in /Products/SAS Visual Analytics Administrator/Visual Analytics LASR. When you select a SAS LASR Analytic Server table as an input table, be aware of the following best practices if the table is large. If the table is not large, then using it for input requires no special considerations.

Here are the considerations for using a large SAS LASR Analytic Server table as an input table:

A WHERE clause is processed in memory by the server if no aggregations or joins are used. Specify a filter on the Where tab so that you use only the rows that you want.

If you want to join the table, then design one query that copies the data to the same library as the table that you want to join it with. Specify a filter on the Where tab, if applicable. Then, design another query that performs the join.

Datasets created in the data preparation section are loaded in memory of the SAS LASR Analytic Server using the steps shown below:

1. Go to the Prepare Data tab on the SAS Visual Analytics home page.

Figure 6. Prepare data tab on SAS Visual Analytics homepage

Page 7: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

7

2. Use the SAS Folders tree to locate the table. You can also click ‘Search’, and search for the table by name and location.

Figure 7. Select SAS Visual Data Builder to import remote data

3. Select the table, right-click, and select Load a Table.

Figure 8. Load SAS datasets using SAS Visual Data Builder

4. The fields in the Source Table section are filled automatically.

5. Click Submit.

Page 8: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

8

All the input SAS datasets imported from Lose It! and Fitbit were uploaded to the SAS LASR server in this way. The datasets do not contain all the measures required for reporting, therefore a few additional measures need to be created. SAS Visual Analytics allows users to create new measures by defining calculated items.

CREATING CALCULATED ITEMS

In all the SAS datasets that were imported we had a date value. But in order for creating time series SAS analytics visual dashboards, we were required to create additional measures such as year, month, week from the SAS date available in the source data. SAS Visual Analytics allows us to create these measures by defining calculated items.

The explorer enables you to calculate new data items from your existing data items by using an expression. All calculations are performed on un-aggregated data. The calculation expression is evaluated for each row in the data source before aggregations are performed.

In addition to performing mathematical calculations on numeric values, you can use calculated data items to create date and time values. For example, if your data contains separate categories for month, day, and year, then you can calculate a date value from each category.

In our example, we create the calculated items year, month, week in the weekly summary macronutrient data in order to be able to define a hierarchy. Please see below for steps to create a calculated item:

1. Select the SAS dataset used in the report for which you need to create a calculated item. Go to Data, select options and click on ‘New Calculated Item’.

Figure 9. Create new calculated item

2. Enter a Name for the calculated data item.

3. Select the data type for the calculated data item from the Result type drop-down list.

4. Build the expression for your calculated data item by dragging and dropping data items and operators onto the expression in the right pane. For each field in the expression, you can insert a data item, an operator, or a specific value. Note: Derived data items are not supported for calculation expressions.

5. Select the operators that you need to create a calculated item. The calculated item can be defined as a numeric or categorical variable.

Page 9: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

9

Figure 10. Create new calculated item

6. When you drag and drop data items and operators onto the expression, the precise location of the cursor determines where and how the new element is added to the expression. As you drag the new element over the expression, a preview appears, which displays how the expression would change if you drop the element at the current location.

7. For example, in our current expression is month(Date), and if we drag the Date data item over the open parenthesis symbol of month operator, then the expression changes to Month (Date)..

8. There are a large number of operator types available to perform mathematical functions, process datetime values, and evaluate logical processing such as IF clauses. Please refer the SAS® Visual Analytics 6.2: User's Guide, “Operators for Calculated Data Items,” for more details.

9. When you are finished creating your expression, select the Default aggregation for the calculated data item, and then click Select to choose the data format.

10. Click Preview to see a preview of the calculated data item as a table. The table displays the values of the calculated item and any data items that are part of the calculation expression.

11. Click OK to create the new calculated data item. The new data item appears in the Data Items pane

Calculated items are created as show above for obtaining year, month, and week from the ‘Date’ variable in the input data. We also use calculated items to create DRI macronutrient goal values obtained by using the Dietary Reference Intake Calculator which act as benchmark values for daily the macro nutrient intake for an individual.

CREATING HIERARCY

A hierarchy is an arrangement of category columns that is based on parent-child relationships. The levels of a hierarchy are arranged with more general information at the top and more specific information at the bottom.

In order to create time series reports, we create a hierarchy of date-time columns with Year as the top level, Month as the next level, and Day as the bottom level. Creating hierarchies enables us to add drill-down functionality to our visualizations. For example, if you use a date-time hierarchy, you can drill down to the data for a specific year. Then, you can drill down to the data for a specific month. When you drill down a hierarchy, a set of breadcrumb links at the top of your visualization enables you to drill back up the hierarchy.

To create a new hierarchy:

1. Select Data -> New Hierarchy. The New Hierarchy window appears.

Page 10: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

10

2. In the Name field, enter a name for the hierarchy.

Figure 11. Create new hierarchy

3. Select the categories that you want to include in the hierarchy, and then click to add them to the hierarchy.

Note: You can also drag and drop categories.

4. To change the order of the categories in your hierarchy, select the category that you want to move. Then, click to move the category up, or click to move the category down.

5. To remove a category from the hierarchy, select the category that you want to remove. Then, click .

6. Click OK to finish creating the hierarchy.

The Year–Month–Week–Date hierarchy allows us to create a time series report with a drill down functionality to be able to traverse through various time periods in a report.

SAS® VISUAL ANALYTICS DASHBOARDS

In this section we will review working with visualizations, filters, ranking data to create bar/line charts, heat /tree maps, correlations matrices, adding fit line/forecasting to existing visualization, forecast measures for creating various reporting dashboards and for viewing

MACRONUTRIENT DASHBOARD

Macronutrient dashboard report is a combination of 3 reports – Calorie intake, Macronutrient distribution and Macronutrient intake which provides the user with an overview of dietary intake over time.

Page 11: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

11

Display 1. Macronutrient dashboard

In this section, we will further discuss in detail each of the 3 sub-reports and the steps to create the visualizations in these reports.

Calorie Intake Report

Calorie intake report represents the distribution of daily calorie intake across all the meals for over time. It provides the percentage distribution of calories intake during Breakfast, Lunch, Snacks and Dinner. It also shows the amount of calories expended in exercise.

A pie chart displays is found most ideal to represent the above visualization. A pie chart display is a part-to-whole relationship in a circle divided into multiple slices for each value of a category data item based on a single measure data item. Each slice represents the relative contribution of each part to the whole. In a pie chart, the legend is sorted by contribution.

Display 2. Calorie Intake Report

Calorie intake report provided a deep insight to regulate the daily calorie intake across all the meals. This report allowed the user to determine the days when the average calorie intake was high, review average calorie intake over time and allowed the user to review and regulate the intake of calories across every meal.

Page 12: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

12

Macronutrient Distribution Report

Macronutrient distribution report allows the user to monitor the average daily macronutrient intake of all the nutrients such as Carbohydrates (g), Cholesterol (mg), Fat (g), Protein (g), Saturated Fat (g) and Sugar (g). The average daily macronutrient data is monitored and regulated in such a way as to keep the daily consumption under the DRI recommendations.

Display 3. Macronutrient Distribution Report

A bar chart object is used to display the macronutrient distribution report. A bar chart displays data by using bars. The height of each bar represents the value. Stacked bar charts are used to display the average daily macronutrient intake over time. The Year-Month-Date hierarchy was used as the category (X-axis) and the all the macronutrients were added as measures to display the stacked bar chart.

Macronutrient Intake Report

Macronutrient daily intake visualization in a tabular list form is best represented using the crosstab object. A crosstab displays the intersections of category values and measure values as text. If the crosstab contains measures, then each cell of the crosstab contains the aggregated measure values for a specific intersection of category values. If the crosstab does not contain measures, then each cell of the crosstab contains the frequency of an intersection of category values.

The average daily macronutrient intake is represented using crosstab. An easy to read, tabular format displays the average daily macronutrient intake to allow user to monitor the intake is below the recommended DRI values.

Display 4. Macronutrient Intake Crosstab Report

BODY MASS INDEX (BMI) AND BODY WEIGHT DASHBOARD

The Body Mass Index (BMI) and body weight dashboard is a combined report consisting of the BMI over time and the measure of Body Weight over time. The Body mass index (BMI) is a measure of body fat based on height and weight that applies to adult men and women. BMI is calculated as weight in Kilograms divided by height in meters squared. BMI is categorized as follows for adult males:

Underweight = <18.5 Normal weight = 18.5–24.9 Overweight = 25–29.9

Page 13: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

13

Obesity = BMI of 30 or greater

The BMI data available from the Fitbit source is found to be best represented using the Line Chart. A line chart object displays the weight and BMI data as a line chart. A line chart is useful for data trends over time. You can apply grouping and create lattices.

Display 5. Body Mass Index (BMI) and body weight dashboard

Two separate line charts are created – one for measuring the BMI over time and the other to measure the body weight over time. In both the charts, the Year-Month-Week hierarchy object is used as the category and the BMI and Body Weight are used as the measures respectively. The BMI normal range, Goal BMI and Goal Weight is created using the Reference Line.

SLEEP ANALYSIS DASHBOARD

The sleep analysis dashboard consists of the sleep information obtained via the Fitbit application data. This consists of two sub-reports the first measuring the number of hours asleep over time and the second measuring the quality of sleep over time.

The hours asleep report measures the amount of time the user was asleep. It is best found represented using a bar chart. The Year-Month-Date hierarchy is represented as a category and the Hours Asleep is the measure. The set baseline is set to 8 hours to indicate the minimum baseline sleep hours recommended by the U.S. Department of Health & Human Services.

The quality of sleep report is best represented using a dual axis bar chart which shows the amount of hours asleep vs. times awake report over time. The Year-Month-Date hierarchy is assigned as a category variable and the hours asleep and minutes awake are represented on two different axes. The recommended hours of sleep and the maximum times aware goal values are represented as goal lines to be able to monitor quality of sleep.

Page 14: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

14

Display 6. Sleep Analysis dashboard

WORKOUT DASHBOARD

Workout dashboard is comprised of three sub-reports and is used to monitor the activity level of the users over time. The activity level report measures the level of activity of the user over time, the steps dashboard measures the average steps traversed over time and the distance report measures the average daily distance traversed and over time. The data captured via the Fitbit application is visually represented using the bar chart object.

Activity level report

Activity level report is created using the bar chart object. The Year-Month-Week-Date hierarchy object is used as the category variable. The measures Minutes Fairly Active, Minutes Lightly Active, Minutes Sedentary and Minutes Very Active are plotted as the measures. The Grouping Style is changed to stack to be able to determine the average activity levels during a 24 hour time period.

Display 7. Average activity level dashboard

The using the hierarchy as a measure allows us the drill up-drill down ability to monitory average activity levels over the period of a year, month, week or a day. Moving the pointer on the bar chart over the colored section shows the actual time of activity.

Page 15: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

15

Steps traversed report

The steps traversed report is best displayed using a time series plot. A time series plot shows an ordered sequence of values that are observed at equally spaced time intervals. A time series plot requires a date, datetime, or time data item that is continuous. This report monitors the trend of number of steps traversed every day. The step goal is set to 10,000 steps per day and can be customized. The date is plotted on the time axis and the Steps are selected as the measure line. Checking the show markers box in the properties of the Time Series Plot displays the markers and the marker values in the report.

Display 8. Workout dashboard

Distance traversed report

The distance traversed report monitors horizontal distance and vertical distance traversed in terms of average miles per day and the average number of floors climbed per day respectively. These measures are represented via the dual axis time series plot. The dual axis time series plot is a variation of the time series plot that has two measures. A measure is displayed on both the left and right side of the Y axis. In our example we monitor the average distance traversed in miles per day on one axis and average number of floors climbed per day on another. Reference lines are created to track the ‘Distance’ and ‘Floors’ goal and daily activity is monitored against this benchmark.

Display 9. Distance traversed report

Page 16: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

16

DIETARY REFERENCE INTAKE (DRI) DASHBOARD

The dietary reference intake (DRI) dashboard monitors the intake of vital macronutrient that contributes to the amount of calorie intake of an individual per day. The intake of Carbohydrates (g), Proteins (g) and Fat (g) is compared against the benchmark established by the U.S. Department of Health & Human Services for average healthy adult male. The daily average intake of each macronutrient was closely monitored and compared against the benchmark to ensure the intake was within specified limits.

Display 10. Dietary Reference Intake (DRI) dashboard

A targeted bar chart object was found to best represent the macro nutrient data. A targeted bar chart is a variation of the bar chart that has pointers to target values. In this example, the pointers appear on the right side of each bar. The target DRI values for each macronutrient is created as a calculated object and act as established benchmark. The Year-Month-Week-Date hierarchy is selected as the measure and the benchmark value is entered as the target.

CONCLUSION

In the course of this paper, we explored various capabilities of SAS Visual Analytics in terms of in-memory visualization and reporting tool, ease of data preparation and the high speed of data access. We showed using SAS Visual Analytics how easy it is to analyze data, create visualizations, charts, graphs for analyzing the health and nutrition data from external third party tools and applications . We found it to be perfect tool for use by data analysts who are not necessarily trained in advanced analytics. It helps the users to visualize results in a quick comprehensive manner. SAS Visual Analytics also acted as a great sandbox area to explore, build reports, and share the results with others. SAS Visual Analytics was found to have the power to slice and dice data. Also, having data stored loaded to the memory was found to be a great advantage in terms of performance. SAS Visual Analytics drill-down facility is very useful for the end user to see the data at different granular levels and allows users to represent the same at various summary and detail level reports.

During this case study and over the course of this paper, it was observed that it is really easy to be able to create and monitor health dashboards which source data from third party applications such as Fitbit and Lose It! and update the dashboards over time. The data handling, data cleansing, loading the data to memory, creation of powerful visualizations and reporting dashboards allows end users great flexibility and puts the power of self-service data analysis into the hands of non-statisticians. This tool facilitates collaboration between business analysts and data statisticians resulting in more well-rounded business insight from the data. SAS Visual Analytics is a really powerful tool that SAS offers. It makes it very easy for the SAS users and non-SAS users to create graphs, visualizations, reports using SAS Visual Analytics.

Page 17: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

17

REFERENCES

SAS Institute Inc. 2013. SAS® Visual Analytics 6.2: Getting Started with Exploration and Reporting. Cary, NC: SAS

Institute Inc. SAS® Visual Analytics 6.2: Getting Started with Exploration and Reporting. Copyright © 2013, SAS

Institute Inc., Cary, NC, USA

SAS Institute Inc. 2013. SAS® Visual Analytics 6.2: User's Guide. Cary, NC: SAS Institute Inc. SAS

® Visual Analytics

6.2: User's Guide. Copyright © 2013, SAS Institute Inc., Cary, NC, USA

ACKNOWLEDGMENTS

I would like to profusely thank our organizational management - Michael Sirek and Sunmin Park for being very supportive of me to write and present a paper. I would like to thank Thomas Billings for his zest, enthusiasm and for being a great guide during my work at MUFG Union Bank N.A. I would like to thank Baskar Anjappan for encouraging me to write and publish a paper. I would also thank my employers MUFG Union Bank N.A. for providing me with an opportunity to attend the conference.

CONTACT INFORMATION

Your comments and questions are valued and encouraged. Contact the author at:

Name: Viraj Ratnakar Kumbhakarna Enterprise: MUFG Union Bank N.A. Address: 5600 Caprice Cmn. City, State ZIP: Fremont, CA, 94538 E-mail: [email protected] LinkedIn: https://www.linkedin.com/pub/viraj-kumbhakarna/25/2a4/371

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Other brand and product names are trademarks of their respective companies.

DISCLAIMER

The contents of the paper herein are solely the author’s thoughts and opinions, which do not represent those of MUFG Union Bank N.A. MUFG Union Bank N.A. does not endorse, recommend, or promote any of the computing architectures, platforms, software, programming techniques or styles referenced in this paper.

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.

Other brand and product names are trademarks of their respective companies.

The output/code/data analysis for this paper was generated using SAS software. Copyright, SAS Institute Inc. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc., Cary, NC, USA.

Copyright 2013, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. Reproduced with permission of SAS Institute Inc., Cary, NC

IBM® and AIX

® are trademarks of International Business Machines Corporation, registered in many jurisdictions

worldwide

Page 18: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

18

APPENDIX

LOSE IT! WEEKLY SUMMARY DATA IMPORT SOURCE CODE

libname output "<directory name>";

%macro weeklysum(infilename=,dsn=);

DATA &dsn.;

LENGTH

date 8

name $ 100

type $ 50

quantity 8

units $ 20

calories 8

fat__g_ 8

protein__g_ 8

carbohydrates__g_ 8

saturated_fat__g_ 8

sugars__g_ 8

fiber__g_ 8

cholesterol__mg_ 8

sodium__mg_ 8 ;

LABEL

date = "Date"

name = "Name"

type = "Type"

quantity = "Quantity"

units = "Units"

calories = "Calories"

fat__g_ = "Fat (g)"

protein__g_ = "Protein (g)"

carbohydrates__g_ = "Carbohydrates (g)"

saturated_fat__g_ = "Saturated Fat (g)"

sugars__g_ = "Sugars (g)"

fiber__g_ = "Fiber (g)"

cholesterol__mg_ = "Cholesterol (mg)"

sodium__mg_ = "Sodium (mg)" ;

FORMAT

date MMDDYY10.

name $CHAR100.

type $CHAR50.

quantity BEST4.

units $CHAR20.

calories BEST7.

fat__g_ BEST5.

protein__g_ BEST5.

carbohydrates__g_ BEST6.

saturated_fat__g_ BEST12.

sugars__g_ BEST12.

fiber__g_ BEST5.

cholesterol__mg_ BEST12.

sodium__mg_ BEST7. ;

INFORMAT

date MMDDYY10.

name $CHAR100.

type $CHAR50.

quantity BEST4.

units $CHAR20.

calories BEST7.

fat__g_ BEST5.

protein__g_ BEST5.

carbohydrates__g_ BEST6.

saturated_fat__g_ BEST12.

Page 19: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

19

sugars__g_ BEST12.

fiber__g_ BEST5.

cholesterol__mg_ BEST12.

sodium__mg_ BEST7. ;

INFILE "&infilename."

LRECL=118

MISSOVER

DSD

firstobs= 2;

;

INPUT

date : ?? MMDDYY10.

name : $CHAR100.

type : $CHAR50.

quantity : ?? COMMA4.

units : $CHAR20.

calories : ?? COMMA7.

fat__g_ : ?? COMMA5.

protein__g_ : ?? COMMA5.

carbohydrates__g_ : ?? COMMA6.

saturated_fat__g_ : ?? BEST4.

sugars__g_ : ?? BEST5.

fiber__g_ : ?? COMMA5.

cholesterol__mg_ : ?? BEST5.

sodium__mg_ : ?? COMMA7. ;

RUN;

proc append base=output.weekly_summary data=&dsn.;

run;

%mend weeklysum;

%weeklysum(infilename=<Directory name>/WeeklySummary5167.csv,

dsn=output.WeeklySummary5167)

FITBIT DATA IMPORT SOURCE CODE

Fitbit Body Weight and BMI Data import source code

DATA WORK.fitbit_1;

LENGTH

Date 8

Weight 8

BMI 8

Fat 8 ;

FORMAT

Date MMDDYY10.

Weight BEST6.

BMI BEST5.

Fat BEST2. ;

INFORMAT

Date MMDDYY10.

Weight BEST6.

BMI BEST5.

Fat BEST2. ;

INFILE '<directory name>/<filename>'

DLM='7F'x

MISSOVER

FIRSTOBS=2

DSD

;

INPUT

Date : ?? MMDDYY9.

Weight : ?? COMMA6.

BMI : ?? COMMA5.

Fat : ?? BEST2. ;

Page 20: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

20

RUN;

Fitbit Calorie Intake Data import source code

DATA WORK.fitbit_2;

LENGTH

date 8

calories_in 8 ;

LABEL

date = "Date"

calories_in = "Calories In" ;

FORMAT

date MMDDYY10.

calories_in BEST5. ;

INFORMAT

date MMDDYY10.

calories_in BEST5. ;

INFILE '<directory name>/<filename>'

DLM='7F'x

MISSOVER

FIRSTOBS=2

DSD

;

INPUT

date : ?? MMDDYY9.

calories_in : ?? COMMA5. ;

RUN;

Fitbit activity level data import source code

DATA WORK.fitbit_3;

LENGTH

date 8

calories_burned 8

steps 8

distance 8

floors 8

minutes_sedentary 8

minutes_lightly_active 8

minutes_fairly_active 8

minutes_very_active 8

activity_calories 8 ;

LABEL

date = "Date"

calories_burned = "Calories Burned"

steps = "Steps"

distance = "Distance"

floors = "Floors"

minutes_sedentary = "Minutes Sedentary"

minutes_lightly_active = "Minutes Lightly Active"

minutes_fairly_active = "Minutes Fairly Active"

minutes_very_active = "Minutes Very Active"

activity_calories = "Activity Calories" ;

FORMAT

date MMDDYY10.

calories_burned BEST5.

steps BEST6.

distance BEST5.

floors BEST2.

minutes_sedentary BEST5.

minutes_lightly_active BEST3.

minutes_fairly_active BEST2.

minutes_very_active BEST3.

Page 21: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

21

activity_calories BEST5. ;

INFORMAT

date MMDDYY10.

calories_burned BEST5.

steps BEST6.

distance BEST5.

floors BEST2.

minutes_sedentary BEST5.

minutes_lightly_active BEST3.

minutes_fairly_active BEST2.

minutes_very_active BEST3.

activity_calories BEST5. ;

INFILE '<directory name>/<filename>'

DLM='7F'x

MISSOVER

FIRSTOBS=2

DSD

;

INPUT

date : ?? MMDDYY9.

calories_burned : ?? COMMA5.

steps : ?? COMMA6.

distance : ?? COMMA5.

floors : ?? BEST2.

minutes_sedentary : ?? COMMA5.

minutes_lightly_active : ?? BEST3.

minutes_fairly_active : ?? BEST2.

minutes_very_active : ?? BEST3.

activity_calories : ?? COMMA5. ;

RUN;

Fitbit activity level data import source code

DATA WORK.fitbit_4;

LENGTH

date 8

minutes_asleep 8

minutes_awake 8

number_of_awakenings 8

time_in_bed 8

;

LABEL

date = "Date"

minutes_asleep = "Minutes Asleep"

minutes_awake = "Minutes Awake"

number_of_awakenings = "Number of Awakenings"

time_in_bed = "Time in Bed"

;

FORMAT

date MMDDYY10.

minutes_asleep BEST3.

minutes_awake BEST2.

number_of_awakenings BEST2.

time_in_bed BEST3.

;

INFORMAT

date MMDDYY10.

minutes_asleep BEST3.

minutes_awake BEST2.

number_of_awakenings BEST2.

time_in_bed BEST3.

;

INFILE '<directory name>/<filename>'

DLM='7F'x

Page 22: Exploring SAS Visual Analytics capabilities to go from Fat ... · macronutrient intake levels to lose weight and get in shape. A study was made of the dietary recommendation for a

Exploring SAS® Visual Analytics capabilities to go from Fat to Fit!

22

MISSOVER

FIRSTOBS=2

DSD

;

INPUT

date : ?? MMDDYY9.

minutes_asleep : ?? BEST3.

minutes_awake : ?? BEST2.

number_of_awakenings : ?? BEST2.

time_in_bed : ?? BEST3.

;

RUN;