166.MASTERING SAS DATA ANALYSIS | LEVERAGING PROC SQL | PROC MEANS | PROC TIMESERIES FOR COMPREHENSIVE INSIGHTS
- Get link
- X
- Other Apps
MASTERING SAS DATA ANALYSIS | LEVERAGING PROC SQL | PROC MEANS | PROC TIMESERIES FOR COMPREHENSIVE INSIGHTS
/*Creating a unique dataset centered around Mobile App Usage Analytics*/
/*Dataset: Mobile App Usage Analytics*/
User_ID: Unique identifier for each user.
Session_ID: Unique identifier for each session.
Session_Start: Timestamp when the session began.
Session_End: Timestamp when the session ended.
Pages_Viewed: Number of pages/screens viewed during the session.
Actions_Performed: Number of actions (clicks, swipes, etc.) performed.
Device_Type: Type of device used (e.g., Android, iOS).
App_Version: Version of the app used during the session.
Location: Geographical location of the user during the session.
In_App_Purchase: Indicator if an in-app purchase was made (Yes/No).
/*Creating the Dataset*/
data app_usage;
format Session_Start Session_End datetime20.;
call streaminit(123); /* Initialize the random number stream with a seed */
Session_ID = 0;
do User_ID = 1 to 20;
Session_ID + 1;
Session_Start = datetime() - ceil(rand("Uniform")*30*24*60*60);
Session_End = Session_Start + ceil(rand("Uniform")*3600);
Pages_Viewed = ceil(rand("Uniform")*10);
Actions_Performed = ceil(rand("Uniform")*20);
Device_Type = CHOOSEC(ceil(rand("Uniform")*2), 'Android', 'iOS');
App_Version = CHOOSEC(ceil(rand("Uniform")*3), '1.0', '1.1', '1.2');
Location = CHOOSEC(ceil(rand("Uniform")*3), 'Hyderabad', 'Mumbai', 'Delhi');
In_App_Purchase = CHOOSEC(ceil(rand("Uniform")*2), 'Yes', 'No');
output;
end;
run;
proc print;run;
Output:
Obs | Session_Start | Session_End | Session_ID | User_ID | Pages_Viewed | Actions_Performed | Device_Type | App_Version | Location | In_App_Purchase |
---|---|---|---|---|---|---|---|---|---|---|
1 | 27AUG2015:13:48:37 | 27AUG2015:13:50:46 | 1 | 1 | 1 | 8 | Android | 1.1 | Mumbai | Yes |
2 | 12SEP2015:07:48:34 | 12SEP2015:07:53:22 | 2 | 2 | 10 | 5 | Android | 1.2 | Delhi | No |
3 | 03SEP2015:20:06:10 | 03SEP2015:20:54:48 | 3 | 3 | 1 | 9 | iOS | 1.0 | Hyderabad | Yes |
4 | 23AUG2015:16:49:58 | 23AUG2015:17:34:04 | 4 | 4 | 10 | 16 | iOS | 1.2 | Mumbai | No |
5 | 31AUG2015:21:13:45 | 31AUG2015:22:13:12 | 5 | 5 | 7 | 6 | iOS | 1.2 | Delhi | No |
6 | 28AUG2015:10:13:02 | 28AUG2015:11:10:43 | 6 | 6 | 8 | 11 | iOS | 1.0 | Delhi | No |
7 | 16AUG2015:10:36:47 | 16AUG2015:10:57:54 | 7 | 7 | 8 | 19 | iOS | 1.2 | Delhi | Yes |
8 | 23AUG2015:09:23:38 | 23AUG2015:10:13:46 | 8 | 8 | 9 | 2 | Android | 1.0 | Delhi | No |
9 | 11SEP2015:01:34:04 | 11SEP2015:01:52:44 | 9 | 9 | 4 | 20 | iOS | 1.1 | Delhi | No |
10 | 24AUG2015:21:52:02 | 24AUG2015:22:30:48 | 10 | 10 | 8 | 4 | iOS | 1.1 | Hyderabad | No |
11 | 17AUG2015:18:03:04 | 17AUG2015:18:59:36 | 11 | 11 | 3 | 20 | iOS | 1.0 | Delhi | No |
12 | 18AUG2015:16:13:49 | 18AUG2015:16:23:29 | 12 | 12 | 4 | 17 | iOS | 1.1 | Mumbai | Yes |
13 | 10SEP2015:22:31:02 | 10SEP2015:22:44:26 | 13 | 13 | 10 | 8 | iOS | 1.1 | Delhi | Yes |
14 | 03SEP2015:21:35:38 | 03SEP2015:22:11:16 | 14 | 14 | 2 | 14 | iOS | 1.1 | Hyderabad | Yes |
15 | 19AUG2015:10:58:32 | 19AUG2015:11:09:17 | 15 | 15 | 3 | 6 | Android | 1.1 | Delhi | No |
16 | 21AUG2015:17:02:57 | 21AUG2015:17:20:17 | 16 | 16 | 3 | 19 | Android | 1.1 | Mumbai | No |
17 | 21AUG2015:11:27:40 | 21AUG2015:12:13:38 | 17 | 17 | 2 | 10 | iOS | 1.2 | Delhi | No |
18 | 02SEP2015:01:09:16 | 02SEP2015:01:49:16 | 18 | 18 | 2 | 18 | iOS | 1.2 | Hyderabad | No |
19 | 29AUG2015:16:29:06 | 29AUG2015:16:35:58 | 19 | 19 | 4 | 1 | iOS | 1.1 | Mumbai | No |
20 | 05SEP2015:18:41:28 | 05SEP2015:19:09:00 | 20 | 20 | 7 | 4 | iOS | 1.1 | Delhi | Yes |
/*Exploring the Dataset*/
proc contents data=app_usage;
run;
Output:
Data Set Name | WORK.APP_USAGE | Observations | 20 |
---|---|---|---|
Member Type | DATA | Variables | 10 |
Engine | V9 | Indexes | 0 |
Created | 14/09/2015 00:38:04 | Observation Length | 848 |
Last Modified | 14/09/2015 00:38:04 | Deleted Observations | 0 |
Protection | Compressed | NO | |
Data Set Type | Sorted | NO | |
Label | |||
Data Representation | WINDOWS_64 | ||
Encoding | wlatin1 Western (Windows) |
Engine/Host Dependent Information | |
---|---|
Data Set Page Size | 69632 |
Number of Data Set Pages | 1 |
First Data Page | 1 |
Max Obs per Page | 82 |
Obs in First Data Page | 20 |
Number of Data Set Repairs | 0 |
ExtendObsCounter | YES |
Filename | C:\Users\Lenovo\AppData\Local\Temp\SAS Temporary Files\_TD11280_DESKTOP-QFAA4KV_\app_usage.sas7bdat |
Release Created | 9.0401M2 |
Host Created | X64_8HOME |
Alphabetic List of Variables and Attributes | ||||
---|---|---|---|---|
# | Variable | Type | Len | Format |
6 | Actions_Performed | Num | 8 | |
8 | App_Version | Char | 200 | |
7 | Device_Type | Char | 200 | |
10 | In_App_Purchase | Char | 200 | |
9 | Location | Char | 200 | |
5 | Pages_Viewed | Num | 8 | |
2 | Session_End | Num | 8 | DATETIME20. |
3 | Session_ID | Num | 8 | |
1 | Session_Start | Num | 8 | DATETIME20. |
4 | User_ID | Num | 8 |
proc print data=app_usage (obs=10);
run;
Output:
Obs | Session_Start | Session_End | Session_ID | User_ID | Pages_Viewed | Actions_Performed | Device_Type | App_Version | Location | In_App_Purchase |
---|---|---|---|---|---|---|---|---|---|---|
1 | 27AUG2015:13:48:37 | 27AUG2015:13:50:46 | 1 | 1 | 1 | 8 | Android | 1.1 | Mumbai | Yes |
2 | 12SEP2015:07:48:34 | 12SEP2015:07:53:22 | 2 | 2 | 10 | 5 | Android | 1.2 | Delhi | No |
3 | 03SEP2015:20:06:10 | 03SEP2015:20:54:48 | 3 | 3 | 1 | 9 | iOS | 1.0 | Hyderabad | Yes |
4 | 23AUG2015:16:49:58 | 23AUG2015:17:34:04 | 4 | 4 | 10 | 16 | iOS | 1.2 | Mumbai | No |
5 | 31AUG2015:21:13:45 | 31AUG2015:22:13:12 | 5 | 5 | 7 | 6 | iOS | 1.2 | Delhi | No |
6 | 28AUG2015:10:13:02 | 28AUG2015:11:10:43 | 6 | 6 | 8 | 11 | iOS | 1.0 | Delhi | No |
7 | 16AUG2015:10:36:47 | 16AUG2015:10:57:54 | 7 | 7 | 8 | 19 | iOS | 1.2 | Delhi | Yes |
8 | 23AUG2015:09:23:38 | 23AUG2015:10:13:46 | 8 | 8 | 9 | 2 | Android | 1.0 | Delhi | No |
9 | 11SEP2015:01:34:04 | 11SEP2015:01:52:44 | 9 | 9 | 4 | 20 | iOS | 1.1 | Delhi | No |
10 | 24AUG2015:21:52:02 | 24AUG2015:22:30:48 | 10 | 10 | 8 | 4 | iOS | 1.1 | Hyderabad | No |
/*Descriptive Statistics*/
data app_usage;
set app_usage;
Session_Duration = (Session_End - Session_Start)/60; /* Duration in minutes */
run;
proc print;run;
Output:
Obs | Session_Start | Session_End | Session_ID | User_ID | Pages_Viewed | Actions_Performed | Device_Type | App_Version | Location | In_App_Purchase | Session_Duration |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 27AUG2015:13:48:37 | 27AUG2015:13:50:46 | 1 | 1 | 1 | 8 | Android | 1.1 | Mumbai | Yes | 2.1500 |
2 | 12SEP2015:07:48:34 | 12SEP2015:07:53:22 | 2 | 2 | 10 | 5 | Android | 1.2 | Delhi | No | 4.8000 |
3 | 03SEP2015:20:06:10 | 03SEP2015:20:54:48 | 3 | 3 | 1 | 9 | iOS | 1.0 | Hyderabad | Yes | 48.6333 |
4 | 23AUG2015:16:49:58 | 23AUG2015:17:34:04 | 4 | 4 | 10 | 16 | iOS | 1.2 | Mumbai | No | 44.1000 |
5 | 31AUG2015:21:13:45 | 31AUG2015:22:13:12 | 5 | 5 | 7 | 6 | iOS | 1.2 | Delhi | No | 59.4500 |
6 | 28AUG2015:10:13:02 | 28AUG2015:11:10:43 | 6 | 6 | 8 | 11 | iOS | 1.0 | Delhi | No | 57.6833 |
7 | 16AUG2015:10:36:47 | 16AUG2015:10:57:54 | 7 | 7 | 8 | 19 | iOS | 1.2 | Delhi | Yes | 21.1167 |
8 | 23AUG2015:09:23:38 | 23AUG2015:10:13:46 | 8 | 8 | 9 | 2 | Android | 1.0 | Delhi | No | 50.1333 |
9 | 11SEP2015:01:34:04 | 11SEP2015:01:52:44 | 9 | 9 | 4 | 20 | iOS | 1.1 | Delhi | No | 18.6667 |
10 | 24AUG2015:21:52:02 | 24AUG2015:22:30:48 | 10 | 10 | 8 | 4 | iOS | 1.1 | Hyderabad | No | 38.7667 |
11 | 17AUG2015:18:03:04 | 17AUG2015:18:59:36 | 11 | 11 | 3 | 20 | iOS | 1.0 | Delhi | No | 56.5333 |
12 | 18AUG2015:16:13:49 | 18AUG2015:16:23:29 | 12 | 12 | 4 | 17 | iOS | 1.1 | Mumbai | Yes | 9.6667 |
13 | 10SEP2015:22:31:02 | 10SEP2015:22:44:26 | 13 | 13 | 10 | 8 | iOS | 1.1 | Delhi | Yes | 13.4000 |
14 | 03SEP2015:21:35:38 | 03SEP2015:22:11:16 | 14 | 14 | 2 | 14 | iOS | 1.1 | Hyderabad | Yes | 35.6333 |
15 | 19AUG2015:10:58:32 | 19AUG2015:11:09:17 | 15 | 15 | 3 | 6 | Android | 1.1 | Delhi | No | 10.7500 |
16 | 21AUG2015:17:02:57 | 21AUG2015:17:20:17 | 16 | 16 | 3 | 19 | Android | 1.1 | Mumbai | No | 17.3333 |
17 | 21AUG2015:11:27:40 | 21AUG2015:12:13:38 | 17 | 17 | 2 | 10 | iOS | 1.2 | Delhi | No | 45.9667 |
18 | 02SEP2015:01:09:16 | 02SEP2015:01:49:16 | 18 | 18 | 2 | 18 | iOS | 1.2 | Hyderabad | No | 40.0000 |
19 | 29AUG2015:16:29:06 | 29AUG2015:16:35:58 | 19 | 19 | 4 | 1 | iOS | 1.1 | Mumbai | No | 6.8667 |
20 | 05SEP2015:18:41:28 | 05SEP2015:19:09:00 | 20 | 20 | 7 | 4 | iOS | 1.1 | Delhi | Yes | 27.5333 |
proc means data=app_usage mean std min max;
var Session_Duration Pages_Viewed Actions_Performed;
run;
Output:
Variable | Mean | Std Dev | Minimum | Maximum | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
/*Frequency Analysis*/
proc freq data=app_usage;
tables Device_Type App_Version Location In_App_Purchase;
run;
Output:
Device_Type | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
Android | 5 | 25.00 | 5 | 25.00 |
iOS | 15 | 75.00 | 20 | 100.00 |
App_Version | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
1.0 | 4 | 20.00 | 4 | 20.00 |
1.1 | 10 | 50.00 | 14 | 70.00 |
1.2 | 6 | 30.00 | 20 | 100.00 |
Location | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
Delhi | 11 | 55.00 | 11 | 55.00 |
Hyderabad | 4 | 20.00 | 15 | 75.00 |
Mumbai | 5 | 25.00 | 20 | 100.00 |
In_App_Purchase | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
No | 13 | 65.00 | 13 | 65.00 |
Yes | 7 | 35.00 | 20 | 100.00 |
/*Cross-tabulation*/
proc freq data=app_usage;
tables Device_Type*In_App_Purchase / chisq;
run;
Output:
|
|
Statistics for Table of Device_Type by In_App_Purchase |
Statistic | DF | Value | Prob |
---|---|---|---|
Chi-Square | 1 | 0.6593 | 0.4168 |
Likelihood Ratio Chi-Square | 1 | 0.7035 | 0.4016 |
Continuity Adj. Chi-Square | 1 | 0.0733 | 0.7866 |
Mantel-Haenszel Chi-Square | 1 | 0.6264 | 0.4287 |
Phi Coefficient | 0.1816 | ||
Contingency Coefficient | 0.1786 | ||
Cramer's V | 0.1816 | ||
WARNING: 50% of the cells have expected counts
less than 5. Chi-Square may not be a valid test. |
Fisher's Exact Test | |
---|---|
Cell (1,1) Frequency (F) | 4 |
Left-sided Pr <= F | 0.9170 |
Right-sided Pr >= F | 0.4058 |
Table Probability (P) | 0.3228 |
Two-sided Pr <= P | 0.6126 |
Sample Size = 20 |
/*Time Series Analysis*/
data session_trends;
set app_usage;
Session_Date = datepart(Session_Start);
format Session_Date date9.;
run;
proc print;run;
Output:
Obs | Session_Start | Session_End | Session_ID | User_ID | Pages_Viewed | Actions_Performed | Device_Type | App_Version | Location | In_App_Purchase | Session_Duration | Session_Date |
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 27AUG2015:13:48:37 | 27AUG2015:13:50:46 | 1 | 1 | 1 | 8 | Android | 1.1 | Mumbai | Yes | 2.1500 | 27AUG2015 |
2 | 12SEP2015:07:48:34 | 12SEP2015:07:53:22 | 2 | 2 | 10 | 5 | Android | 1.2 | Delhi | No | 4.8000 | 12SEP2015 |
3 | 03SEP2015:20:06:10 | 03SEP2015:20:54:48 | 3 | 3 | 1 | 9 | iOS | 1.0 | Hyderabad | Yes | 48.6333 | 03SEP2015 |
4 | 23AUG2015:16:49:58 | 23AUG2015:17:34:04 | 4 | 4 | 10 | 16 | iOS | 1.2 | Mumbai | No | 44.1000 | 23AUG2015 |
5 | 31AUG2015:21:13:45 | 31AUG2015:22:13:12 | 5 | 5 | 7 | 6 | iOS | 1.2 | Delhi | No | 59.4500 | 31AUG2015 |
6 | 28AUG2015:10:13:02 | 28AUG2015:11:10:43 | 6 | 6 | 8 | 11 | iOS | 1.0 | Delhi | No | 57.6833 | 28AUG2015 |
7 | 16AUG2015:10:36:47 | 16AUG2015:10:57:54 | 7 | 7 | 8 | 19 | iOS | 1.2 | Delhi | Yes | 21.1167 | 16AUG2015 |
8 | 23AUG2015:09:23:38 | 23AUG2015:10:13:46 | 8 | 8 | 9 | 2 | Android | 1.0 | Delhi | No | 50.1333 | 23AUG2015 |
9 | 11SEP2015:01:34:04 | 11SEP2015:01:52:44 | 9 | 9 | 4 | 20 | iOS | 1.1 | Delhi | No | 18.6667 | 11SEP2015 |
10 | 24AUG2015:21:52:02 | 24AUG2015:22:30:48 | 10 | 10 | 8 | 4 | iOS | 1.1 | Hyderabad | No | 38.7667 | 24AUG2015 |
11 | 17AUG2015:18:03:04 | 17AUG2015:18:59:36 | 11 | 11 | 3 | 20 | iOS | 1.0 | Delhi | No | 56.5333 | 17AUG2015 |
12 | 18AUG2015:16:13:49 | 18AUG2015:16:23:29 | 12 | 12 | 4 | 17 | iOS | 1.1 | Mumbai | Yes | 9.6667 | 18AUG2015 |
13 | 10SEP2015:22:31:02 | 10SEP2015:22:44:26 | 13 | 13 | 10 | 8 | iOS | 1.1 | Delhi | Yes | 13.4000 | 10SEP2015 |
14 | 03SEP2015:21:35:38 | 03SEP2015:22:11:16 | 14 | 14 | 2 | 14 | iOS | 1.1 | Hyderabad | Yes | 35.6333 | 03SEP2015 |
15 | 19AUG2015:10:58:32 | 19AUG2015:11:09:17 | 15 | 15 | 3 | 6 | Android | 1.1 | Delhi | No | 10.7500 | 19AUG2015 |
16 | 21AUG2015:17:02:57 | 21AUG2015:17:20:17 | 16 | 16 | 3 | 19 | Android | 1.1 | Mumbai | No | 17.3333 | 21AUG2015 |
17 | 21AUG2015:11:27:40 | 21AUG2015:12:13:38 | 17 | 17 | 2 | 10 | iOS | 1.2 | Delhi | No | 45.9667 | 21AUG2015 |
18 | 02SEP2015:01:09:16 | 02SEP2015:01:49:16 | 18 | 18 | 2 | 18 | iOS | 1.2 | Hyderabad | No | 40.0000 | 02SEP2015 |
19 | 29AUG2015:16:29:06 | 29AUG2015:16:35:58 | 19 | 19 | 4 | 1 | iOS | 1.1 | Mumbai | No | 6.8667 | 29AUG2015 |
20 | 05SEP2015:18:41:28 | 05SEP2015:19:09:00 | 20 | 20 | 7 | 4 | iOS | 1.1 | Delhi | Yes | 27.5333 | 05SEP2015 |
proc sql;
create table session_daily as
select Session_Date,
count(Session_ID) as Num_Sessions
from session_trends
group by Session_Date
order by Session_Date;
quit;
proc timeseries data=session_daily out=trend_analysis;
id Session_Date interval=day;
var Num_Sessions;
run;
proc print;run;
Obs | Session_Date | Num_Sessions |
---|---|---|
1 | 16AUG2015 | 1 |
2 | 17AUG2015 | 1 |
3 | 18AUG2015 | 1 |
4 | 19AUG2015 | 1 |
5 | 20AUG2015 | . |
6 | 21AUG2015 | 2 |
7 | 22AUG2015 | . |
8 | 23AUG2015 | 2 |
9 | 24AUG2015 | 1 |
10 | 25AUG2015 | . |
11 | 26AUG2015 | . |
12 | 27AUG2015 | 1 |
13 | 28AUG2015 | 1 |
14 | 29AUG2015 | 1 |
15 | 30AUG2015 | . |
16 | 31AUG2015 | 1 |
17 | 01SEP2015 | . |
18 | 02SEP2015 | 1 |
19 | 03SEP2015 | 2 |
20 | 04SEP2015 | . |
21 | 05SEP2015 | 1 |
22 | 06SEP2015 | . |
23 | 07SEP2015 | . |
24 | 08SEP2015 | . |
25 | 09SEP2015 | . |
26 | 10SEP2015 | 1 |
27 | 11SEP2015 | 1 |
28 | 12SEP2015 | 1 |
proc sgplot data=trend_analysis;
series x=Session_Date y=Session_ID;
xaxis label='Date';
yaxis label='Number of Sessions';
run;
Log:
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 2.12 seconds
cpu time 0.43 seconds
NOTE: The column format DATE9 is replaced by an auto-generated format on the axis.
NOTE: The column format DATE9 is replaced by an auto-generated format on the axis.
NOTE: Listing image output written to SGPlot1.png.
NOTE: There were 28 observations read from the data set WORK.TREND_ANALYSIS.
/*Using PROC SQL for Aggregation*/
proc sql;
create table user_summary as
select User_ID,
count(Session_ID) as Total_Sessions,
mean(Session_Duration) as Avg_Session_Duration
from app_usage
group by User_ID;
quit;
proc print;run;
Output:
Obs | User_ID | Total_Sessions | Avg_Session_Duration |
---|---|---|---|
1 | 1 | 1 | 2.1500 |
2 | 2 | 1 | 4.8000 |
3 | 3 | 1 | 48.6333 |
4 | 4 | 1 | 44.1000 |
5 | 5 | 1 | 59.4500 |
6 | 6 | 1 | 57.6833 |
7 | 7 | 1 | 21.1167 |
8 | 8 | 1 | 50.1333 |
9 | 9 | 1 | 18.6667 |
10 | 10 | 1 | 38.7667 |
11 | 11 | 1 | 56.5333 |
12 | 12 | 1 | 9.6667 |
13 | 13 | 1 | 13.4000 |
14 | 14 | 1 | 35.6333 |
15 | 15 | 1 | 10.7500 |
16 | 16 | 1 | 17.3333 |
17 | 17 | 1 | 45.9667 |
18 | 18 | 1 | 40.0000 |
19 | 19 | 1 | 6.8667 |
20 | 20 | 1 | 27.5333 |
/*Creating Macro Variables*/
proc sql noprint outobs=5;
select Location, count(*) as Session_Count
into :top_loc1 - :top_loc5
from app_usage
group by Location
order by Session_Count desc;
quit;
%put &top_loc1
Log:Delhi
%put &top_loc2
Log:Mumbai
%put &top_loc3
Log:Hyderabad
%put &top_loc4
%put &top_loc5;
/*Visualization*/
proc sgplot data=app_usage;
vbar Device_Type / response=Session_Duration stat=mean;
yaxis label='Average Session Duration (minutes)';
xaxis label='Device Type';
run;
Log:
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.51 seconds
cpu time 0.07 seconds
NOTE: Listing image output written to SGPlot3.png.
NOTE: There were 20 observations read from the data set WORK.APP_USAGE.
/*Handling Missing Values*/
proc means data=app_usage n nmiss;
var Session_Duration Pages_Viewed Actions_Performed;
run;
Output:
Variable | N | N Miss | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
data app_usage_clean;
set app_usage;
if cmiss(of Session_Duration Pages_Viewed Actions_Performed) = 0;
run;
proc print;run;
Output:
Obs | Session_Start | Session_End | Session_ID | User_ID | Pages_Viewed | Actions_Performed | Device_Type | App_Version | Location | In_App_Purchase | Session_Duration |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 27AUG2015:13:20:53 | 27AUG2015:13:23:02 | 1 | 1 | 1 | 8 | Android | 1.1 | Mumbai | Yes | 2.1500 |
2 | 12SEP2015:07:20:50 | 12SEP2015:07:25:38 | 2 | 2 | 10 | 5 | Android | 1.2 | Delhi | No | 4.8000 |
3 | 03SEP2015:19:38:26 | 03SEP2015:20:27:04 | 3 | 3 | 1 | 9 | iOS | 1.0 | Hyderabad | Yes | 48.6333 |
4 | 23AUG2015:16:22:14 | 23AUG2015:17:06:20 | 4 | 4 | 10 | 16 | iOS | 1.2 | Mumbai | No | 44.1000 |
5 | 31AUG2015:20:46:01 | 31AUG2015:21:45:28 | 5 | 5 | 7 | 6 | iOS | 1.2 | Delhi | No | 59.4500 |
6 | 28AUG2015:09:45:18 | 28AUG2015:10:42:59 | 6 | 6 | 8 | 11 | iOS | 1.0 | Delhi | No | 57.6833 |
7 | 16AUG2015:10:09:03 | 16AUG2015:10:30:10 | 7 | 7 | 8 | 19 | iOS | 1.2 | Delhi | Yes | 21.1167 |
8 | 23AUG2015:08:55:54 | 23AUG2015:09:46:02 | 8 | 8 | 9 | 2 | Android | 1.0 | Delhi | No | 50.1333 |
9 | 11SEP2015:01:06:20 | 11SEP2015:01:25:00 | 9 | 9 | 4 | 20 | iOS | 1.1 | Delhi | No | 18.6667 |
10 | 24AUG2015:21:24:18 | 24AUG2015:22:03:04 | 10 | 10 | 8 | 4 | iOS | 1.1 | Hyderabad | No | 38.7667 |
11 | 17AUG2015:17:35:20 | 17AUG2015:18:31:52 | 11 | 11 | 3 | 20 | iOS | 1.0 | Delhi | No | 56.5333 |
12 | 18AUG2015:15:46:05 | 18AUG2015:15:55:45 | 12 | 12 | 4 | 17 | iOS | 1.1 | Mumbai | Yes | 9.6667 |
13 | 10SEP2015:22:03:18 | 10SEP2015:22:16:42 | 13 | 13 | 10 | 8 | iOS | 1.1 | Delhi | Yes | 13.4000 |
14 | 03SEP2015:21:07:54 | 03SEP2015:21:43:32 | 14 | 14 | 2 | 14 | iOS | 1.1 | Hyderabad | Yes | 35.6333 |
15 | 19AUG2015:10:30:48 | 19AUG2015:10:41:33 | 15 | 15 | 3 | 6 | Android | 1.1 | Delhi | No | 10.7500 |
16 | 21AUG2015:16:35:13 | 21AUG2015:16:52:33 | 16 | 16 | 3 | 19 | Android | 1.1 | Mumbai | No | 17.3333 |
17 | 21AUG2015:10:59:56 | 21AUG2015:11:45:54 | 17 | 17 | 2 | 10 | iOS | 1.2 | Delhi | No | 45.9667 |
18 | 02SEP2015:00:41:32 | 02SEP2015:01:21:32 | 18 | 18 | 2 | 18 | iOS | 1.2 | Hyderabad | No | 40.0000 |
19 | 29AUG2015:16:01:22 | 29AUG2015:16:08:14 | 19 | 19 | 4 | 1 | iOS | 1.1 | Mumbai | No | 6.8667 |
20 | 05SEP2015:18:13:44 | 05SEP2015:18:41:16 | 20 | 20 | 7 | 4 | iOS | 1.1 | Delhi | Yes | 27.5333 |
/*Creating Derived Variables*/
data app_usage;
set app_usage;
length Session_Length $6;
if Session_Duration < 5 then Session_Length = 'Short';
else if Session_Duration < 15 then Session_Length = 'Medium';
else Session_Length = 'Long';
run;
proc print;run;
Output:
Obs | Session_Start | Session_End | Session_ID | User_ID | Pages_Viewed | Actions_Performed | Device_Type | App_Version | Location | In_App_Purchase | Session_Duration | Session_Length |
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 27AUG2015:13:20:53 | 27AUG2015:13:23:02 | 1 | 1 | 1 | 8 | Android | 1.1 | Mumbai | Yes | 2.1500 | Short |
2 | 12SEP2015:07:20:50 | 12SEP2015:07:25:38 | 2 | 2 | 10 | 5 | Android | 1.2 | Delhi | No | 4.8000 | Short |
3 | 03SEP2015:19:38:26 | 03SEP2015:20:27:04 | 3 | 3 | 1 | 9 | iOS | 1.0 | Hyderabad | Yes | 48.6333 | Long |
4 | 23AUG2015:16:22:14 | 23AUG2015:17:06:20 | 4 | 4 | 10 | 16 | iOS | 1.2 | Mumbai | No | 44.1000 | Long |
5 | 31AUG2015:20:46:01 | 31AUG2015:21:45:28 | 5 | 5 | 7 | 6 | iOS | 1.2 | Delhi | No | 59.4500 | Long |
6 | 28AUG2015:09:45:18 | 28AUG2015:10:42:59 | 6 | 6 | 8 | 11 | iOS | 1.0 | Delhi | No | 57.6833 | Long |
7 | 16AUG2015:10:09:03 | 16AUG2015:10:30:10 | 7 | 7 | 8 | 19 | iOS | 1.2 | Delhi | Yes | 21.1167 | Long |
8 | 23AUG2015:08:55:54 | 23AUG2015:09:46:02 | 8 | 8 | 9 | 2 | Android | 1.0 | Delhi | No | 50.1333 | Long |
9 | 11SEP2015:01:06:20 | 11SEP2015:01:25:00 | 9 | 9 | 4 | 20 | iOS | 1.1 | Delhi | No | 18.6667 | Long |
10 | 24AUG2015:21:24:18 | 24AUG2015:22:03:04 | 10 | 10 | 8 | 4 | iOS | 1.1 | Hyderabad | No | 38.7667 | Long |
11 | 17AUG2015:17:35:20 | 17AUG2015:18:31:52 | 11 | 11 | 3 | 20 | iOS | 1.0 | Delhi | No | 56.5333 | Long |
12 | 18AUG2015:15:46:05 | 18AUG2015:15:55:45 | 12 | 12 | 4 | 17 | iOS | 1.1 | Mumbai | Yes | 9.6667 | Medium |
13 | 10SEP2015:22:03:18 | 10SEP2015:22:16:42 | 13 | 13 | 10 | 8 | iOS | 1.1 | Delhi | Yes | 13.4000 | Medium |
14 | 03SEP2015:21:07:54 | 03SEP2015:21:43:32 | 14 | 14 | 2 | 14 | iOS | 1.1 | Hyderabad | Yes | 35.6333 | Long |
15 | 19AUG2015:10:30:48 | 19AUG2015:10:41:33 | 15 | 15 | 3 | 6 | Android | 1.1 | Delhi | No | 10.7500 | Medium |
16 | 21AUG2015:16:35:13 | 21AUG2015:16:52:33 | 16 | 16 | 3 | 19 | Android | 1.1 | Mumbai | No | 17.3333 | Long |
17 | 21AUG2015:10:59:56 | 21AUG2015:11:45:54 | 17 | 17 | 2 | 10 | iOS | 1.2 | Delhi | No | 45.9667 | Long |
18 | 02SEP2015:00:41:32 | 02SEP2015:01:21:32 | 18 | 18 | 2 | 18 | iOS | 1.2 | Hyderabad | No | 40.0000 | Long |
19 | 29AUG2015:16:01:22 | 29AUG2015:16:08:14 | 19 | 19 | 4 | 1 | iOS | 1.1 | Mumbai | No | 6.8667 | Medium |
20 | 05SEP2015:18:13:44 | 05SEP2015:18:41:16 | 20 | 20 | 7 | 4 | iOS | 1.1 | Delhi | Yes | 27.5333 | Long |
- Get link
- X
- Other Apps
Comments
Post a Comment