171.IN-DEPTH ANALYSIS OF ONLINE GAMING USER BEHAVIOR USING SAS | PROC SQL | PROC MEANS | PROC FREQ | PROC UNIVARIATE | PROC SGPLOT | PROC FORMAT | PROC SORT | MACRO PROGRAMMING | DATA STEP TECHNIQUES

IN-DEPTH ANALYSIS OF ONLINE GAMING USER BEHAVIOR USING SAS | PROC SQL | PROC MEANS | PROC FREQ | PROC UNIVARIATE | PROC SGPLOT | PROC FORMAT | PROC SORT | MACRO PROGRAMMING | DATA STEP TECHNIQUES


 /*Creating a unique dataset centered around Online Gaming Platform User Behavior*/

/*Data Simulation*/

data gaming_sessions;

    format session_start session_end datetime20.;

    format in_game_purchases dollar8.2;

    array genres[5] $15 _temporary_ ('RPG', 'FPS', 'Strategy', 'MOBA', 'Simulation');

    array devices[3] $10 _temporary_ ('PC', 'Console', 'Mobile');

    array regions[4] $10 _temporary_ ('NA', 'EU', 'ASIA', 'SA');

    do user_id = 1 to 20;

        do session_num = 1 to ceil(ranuni(0)*3);

            session_id = cats('S', put(user_id, z4.), put(session_num, z2.));

            game_id = cats('G', put(ceil(ranuni(0)*100), z3.));

            game_genre = genres[ceil(ranuni(0)*5)];

            session_start = datetime() - ceil(ranuni(0)*100000);

            session_end = session_start + ceil(ranuni(0)*7200);

            actions_performed = ceil(ranuni(0)*500);

            in_game_purchases = round(ranuni(0)*100, 0.01);

            device_type = devices[ceil(ranuni(0)*3)];

            region = regions[ceil(ranuni(0)*4)];

            output;

        end;

    end;

run;

proc print;run;

Output:

Obs session_start session_end in_game_purchases user_id session_num session_id game_id game_genre actions_performed device_type region
1 13SEP2015:20:08:08 13SEP2015:20:49:10 $12.11 1 1 S000101 G006 MOBA 373 PC NA
2 13SEP2015:16:15:11 13SEP2015:16:20:19 $86.33 2 1 S000201 G028 MOBA 42 Mobile ASIA
3 13SEP2015:11:34:32 13SEP2015:12:21:22 $71.48 2 2 S000202 G084 FPS 470 PC EU
4 13SEP2015:17:11:19 13SEP2015:17:59:35 $8.51 2 3 S000203 G049 Strategy 31 PC NA
5 13SEP2015:20:28:08 13SEP2015:20:59:26 $49.02 3 1 S000301 G081 Strategy 183 Mobile EU
6 12SEP2015:20:52:45 12SEP2015:21:22:28 $57.36 3 2 S000302 G081 MOBA 440 Console SA
7 13SEP2015:12:22:36 13SEP2015:14:00:25 $84.76 4 1 S000401 G031 FPS 25 PC ASIA
8 13SEP2015:20:33:19 13SEP2015:21:03:00 $78.53 4 2 S000402 G091 FPS 11 PC EU
9 13SEP2015:00:51:07 13SEP2015:01:04:22 $59.55 5 1 S000501 G088 Simulation 183 Console ASIA
10 13SEP2015:17:15:57 13SEP2015:17:56:06 $85.35 5 2 S000502 G041 Simulation 288 PC ASIA
11 12SEP2015:22:56:56 12SEP2015:23:40:13 $81.78 6 1 S000601 G049 Strategy 406 Console NA
12 13SEP2015:13:03:57 13SEP2015:14:53:23 $78.24 6 2 S000602 G052 RPG 460 Console EU
13 12SEP2015:22:30:19 12SEP2015:23:08:35 $17.08 6 3 S000603 G034 MOBA 319 Mobile NA
14 13SEP2015:12:12:03 13SEP2015:13:16:48 $10.51 7 1 S000701 G091 FPS 367 PC SA
15 13SEP2015:00:56:14 13SEP2015:02:52:42 $63.10 8 1 S000801 G041 Simulation 461 Console EU
16 13SEP2015:11:43:14 13SEP2015:12:37:22 $9.80 8 2 S000802 G085 RPG 228 Console ASIA
17 13SEP2015:07:24:34 13SEP2015:08:07:46 $48.15 8 3 S000803 G005 FPS 139 PC SA
18 13SEP2015:19:19:27 13SEP2015:19:55:22 $27.07 9 1 S000901 G007 MOBA 103 PC NA
19 13SEP2015:08:18:36 13SEP2015:10:13:16 $97.39 9 2 S000902 G035 Strategy 261 PC NA
20 13SEP2015:03:44:04 13SEP2015:04:07:12 $59.52 9 3 S000903 G038 FPS 490 Mobile SA
21 13SEP2015:06:28:54 13SEP2015:07:48:24 $10.47 10 1 S001001 G015 Simulation 48 Console NA
22 13SEP2015:00:32:35 13SEP2015:02:17:10 $23.05 11 1 S001101 G033 RPG 446 Mobile SA
23 13SEP2015:09:59:56 13SEP2015:10:50:31 $71.62 11 2 S001102 G047 FPS 472 PC EU
24 13SEP2015:08:05:32 13SEP2015:09:02:48 $90.99 11 3 S001103 G079 Strategy 365 Console NA
25 13SEP2015:14:59:00 13SEP2015:15:33:30 $35.76 12 1 S001201 G023 Strategy 238 Console EU
26 13SEP2015:23:21:54 13SEP2015:23:26:22 $99.04 12 2 S001202 G021 FPS 302 Mobile NA
27 12SEP2015:22:16:07 12SEP2015:22:17:54 $99.66 13 1 S001301 G007 MOBA 258 Mobile EU
28 13SEP2015:01:38:00 13SEP2015:02:20:06 $48.28 14 1 S001401 G021 RPG 474 Mobile NA
29 13SEP2015:15:48:13 13SEP2015:17:23:36 $97.26 14 2 S001402 G100 FPS 207 PC NA
30 13SEP2015:08:19:08 13SEP2015:10:01:45 $7.54 14 3 S001403 G039 Simulation 272 Console NA
31 13SEP2015:03:29:28 13SEP2015:05:08:24 $23.52 15 1 S001501 G014 RPG 279 Mobile EU
32 13SEP2015:07:13:02 13SEP2015:08:36:33 $66.59 15 2 S001502 G072 Simulation 306 Mobile SA
33 13SEP2015:12:47:18 13SEP2015:14:04:39 $95.40 15 3 S001503 G072 MOBA 219 PC SA
34 12SEP2015:21:21:44 12SEP2015:22:04:49 $95.55 16 1 S001601 G035 Strategy 73 Mobile SA
35 13SEP2015:14:02:54 13SEP2015:15:35:38 $67.32 17 1 S001701 G022 FPS 175 PC EU
36 13SEP2015:17:56:20 13SEP2015:18:51:24 $65.43 18 1 S001801 G048 Simulation 240 Console ASIA
37 12SEP2015:22:32:46 12SEP2015:23:42:06 $43.66 18 2 S001802 G042 Strategy 183 Mobile ASIA
38 13SEP2015:03:33:57 13SEP2015:04:33:07 $9.11 19 1 S001901 G084 FPS 469 Console ASIA
39 13SEP2015:07:08:08 13SEP2015:08:08:42 $30.12 20 1 S002001 G097 RPG 40 PC ASIA

/*Total Sessions and Average Duration*/

proc sql;

    select count(*) as total_sessions,

           mean(intck('second', session_start, session_end))/60 as avg_duration_minutes

    from gaming_sessions;

quit;

Output:

total_sessions avg_duration_minutes
39 57.4094

/*Top 5 Games by Number of Sessions*/

proc sql outobs=5;

    select game_id, count(*) as session_count

    from gaming_sessions

    group by game_id

    order by session_count desc;

quit;

Output:

game_id session_count
G081 2
G049 2
G084 2
G091 2
G035 2

/*Average Actions per Session by Genre*/

proc sql;

    select game_genre, mean(actions_performed) as avg_actions

    from gaming_sessions

    group by game_genre;

quit;

Output:

game_genre avg_actions
FPS 284.2727
MOBA 250.5714
RPG 321.1667
Simulation 256.8571
Strategy 217.5

/*Total In-Game Purchases by Region*/

proc sql;

    select region, sum(in_game_purchases) as total_purchases

    from gaming_sessions

    group by region;

quit;

Output:

region total_purchases
ASIA 474.11
EU 638.25
NA 597.52
SA 456.13

/*Macro for Genre-Based Analysis*/

%macro genre_report(genre);

    title "Analysis for Genre: &genre";

    proc sql;

        select count(*) as total_sessions,

               mean(actions_performed) as avg_actions,

               sum(in_game_purchases) as total_purchases

        from gaming_sessions

        where game_genre = "&genre";

    quit;

%mend;


%genre_report(RPG);

Output:

                                                             Analysis for Genre: RPG

total_sessions avg_actions total_purchases
6 321.1667 213.01

%genre_report(FPS);

Output:

                                                             Analysis for Genre: FPS

total_sessions avg_actions total_purchases
11 284.2727 697.3

%genre_report(Strategy);

Output:

                                                             Analysis for Genre: Strategy

total_sessions avg_actions total_purchases
8 217.5 502.66

%genre_report(MOBA);

Output:

                                                            Analysis for Genre: MOBA

total_sessions avg_actions total_purchases
7 250.5714 395.01

%genre_report(Simulation);

Output:

                                                      Analysis for Genre: Simulation

total_sessions avg_actions total_purchases
7 256.8571 358.03


/*Creating Separate Datasets per Device Type*/

proc sql noprint;

    select distinct device_type into :device1 - :device3

    from gaming_sessions;

quit;


%macro split_by_device;

    %do i = 1 %to 3;

        data &device&i;

            set gaming_sessions;

            where device_type = "&&device&i";

        run;

    %end;

%mend;


%split_by_device;

Output:

Obs session_start session_end in_game_purchases user_id session_num session_id game_id game_genre actions_performed device_type region
1 12SEP2015:20:52:45 12SEP2015:21:22:28 $57.36 3 2 S000302 G081 MOBA 440 Console SA
2 13SEP2015:00:51:07 13SEP2015:01:04:22 $59.55 5 1 S000501 G088 Simulation 183 Console ASIA
3 12SEP2015:22:56:56 12SEP2015:23:40:13 $81.78 6 1 S000601 G049 Strategy 406 Console NA
4 13SEP2015:13:03:57 13SEP2015:14:53:23 $78.24 6 2 S000602 G052 RPG 460 Console EU
5 13SEP2015:00:56:14 13SEP2015:02:52:42 $63.10 8 1 S000801 G041 Simulation 461 Console EU
6 13SEP2015:11:43:14 13SEP2015:12:37:22 $9.80 8 2 S000802 G085 RPG 228 Console ASIA
7 13SEP2015:06:28:54 13SEP2015:07:48:24 $10.47 10 1 S001001 G015 Simulation 48 Console NA
8 13SEP2015:08:05:32 13SEP2015:09:02:48 $90.99 11 3 S001103 G079 Strategy 365 Console NA
9 13SEP2015:14:59:00 13SEP2015:15:33:30 $35.76 12 1 S001201 G023 Strategy 238 Console EU
10 13SEP2015:08:19:08 13SEP2015:10:01:45 $7.54 14 3 S001403 G039 Simulation 272 Console NA
11 13SEP2015:17:56:20 13SEP2015:18:51:24 $65.43 18 1 S001801 G048 Simulation 240 Console ASIA
12 13SEP2015:03:33:57 13SEP2015:04:33:07 $9.11 19 1 S001901 G084 FPS 469 Console ASIA



Obs session_start session_end in_game_purchases user_id session_num session_id game_id game_genre actions_performed device_type region
1 13SEP2015:16:15:11 13SEP2015:16:20:19 $86.33 2 1 S000201 G028 MOBA 42 Mobile ASIA
2 13SEP2015:20:28:08 13SEP2015:20:59:26 $49.02 3 1 S000301 G081 Strategy 183 Mobile EU
3 12SEP2015:22:30:19 12SEP2015:23:08:35 $17.08 6 3 S000603 G034 MOBA 319 Mobile NA
4 13SEP2015:03:44:04 13SEP2015:04:07:12 $59.52 9 3 S000903 G038 FPS 490 Mobile SA
5 13SEP2015:00:32:35 13SEP2015:02:17:10 $23.05 11 1 S001101 G033 RPG 446 Mobile SA
6 13SEP2015:23:21:54 13SEP2015:23:26:22 $99.04 12 2 S001202 G021 FPS 302 Mobile NA
7 12SEP2015:22:16:07 12SEP2015:22:17:54 $99.66 13 1 S001301 G007 MOBA 258 Mobile EU
8 13SEP2015:01:38:00 13SEP2015:02:20:06 $48.28 14 1 S001401 G021 RPG 474 Mobile NA
9 13SEP2015:03:29:28 13SEP2015:05:08:24 $23.52 15 1 S001501 G014 RPG 279 Mobile EU
10 13SEP2015:07:13:02 13SEP2015:08:36:33 $66.59 15 2 S001502 G072 Simulation 306 Mobile SA
11 12SEP2015:21:21:44 12SEP2015:22:04:49 $95.55 16 1 S001601 G035 Strategy 73 Mobile SA
12 12SEP2015:22:32:46 12SEP2015:23:42:06 $43.66 18 2 S001802 G042 Strategy 183 Mobile ASIA



Obs session_start session_end in_game_purchases user_id session_num session_id game_id game_genre actions_performed device_type region
1 13SEP2015:20:08:08 13SEP2015:20:49:10 $12.11 1 1 S000101 G006 MOBA 373 PC NA
2 13SEP2015:11:34:32 13SEP2015:12:21:22 $71.48 2 2 S000202 G084 FPS 470 PC EU
3 13SEP2015:17:11:19 13SEP2015:17:59:35 $8.51 2 3 S000203 G049 Strategy 31 PC NA
4 13SEP2015:12:22:36 13SEP2015:14:00:25 $84.76 4 1 S000401 G031 FPS 25 PC ASIA
5 13SEP2015:20:33:19 13SEP2015:21:03:00 $78.53 4 2 S000402 G091 FPS 11 PC EU
6 13SEP2015:17:15:57 13SEP2015:17:56:06 $85.35 5 2 S000502 G041 Simulation 288 PC ASIA
7 13SEP2015:12:12:03 13SEP2015:13:16:48 $10.51 7 1 S000701 G091 FPS 367 PC SA
8 13SEP2015:07:24:34 13SEP2015:08:07:46 $48.15 8 3 S000803 G005 FPS 139 PC SA
9 13SEP2015:19:19:27 13SEP2015:19:55:22 $27.07 9 1 S000901 G007 MOBA 103 PC NA
10 13SEP2015:08:18:36 13SEP2015:10:13:16 $97.39 9 2 S000902 G035 Strategy 261 PC NA
11 13SEP2015:09:59:56 13SEP2015:10:50:31 $71.62 11 2 S001102 G047 FPS 472 PC EU
12 13SEP2015:15:48:13 13SEP2015:17:23:36 $97.26 14 2 S001402 G100 FPS 207 PC NA
13 13SEP2015:12:47:18 13SEP2015:14:04:39 $95.40 15 3 S001503 G072 MOBA 219 PC SA
14 13SEP2015:14:02:54 13SEP2015:15:35:38 $67.32 17 1 S001701 G022 FPS 175 PC EU
15 13SEP2015:07:08:08 13SEP2015:08:08:42 $30.12 20 1 S002001 G097 RPG 40 PC ASIA

/*Sessions Over Time*/

data sessions_time;

    set gaming_sessions;

    session_date = datepart(session_start);

    format session_date date9.;

run;

proc print;run;

Output:

Obs session_start session_end in_game_purchases user_id session_num session_id game_id game_genre actions_performed device_type region session_date
1 13SEP2015:20:08:08 13SEP2015:20:49:10 $12.11 1 1 S000101 G006 MOBA 373 PC NA 13SEP2015
2 13SEP2015:16:15:11 13SEP2015:16:20:19 $86.33 2 1 S000201 G028 MOBA 42 Mobile ASIA 13SEP2015
3 13SEP2015:11:34:32 13SEP2015:12:21:22 $71.48 2 2 S000202 G084 FPS 470 PC EU 13SEP2015
4 13SEP2015:17:11:19 13SEP2015:17:59:35 $8.51 2 3 S000203 G049 Strategy 31 PC NA 13SEP2015
5 13SEP2015:20:28:08 13SEP2015:20:59:26 $49.02 3 1 S000301 G081 Strategy 183 Mobile EU 13SEP2015
6 12SEP2015:20:52:45 12SEP2015:21:22:28 $57.36 3 2 S000302 G081 MOBA 440 Console SA 12SEP2015
7 13SEP2015:12:22:36 13SEP2015:14:00:25 $84.76 4 1 S000401 G031 FPS 25 PC ASIA 13SEP2015
8 13SEP2015:20:33:19 13SEP2015:21:03:00 $78.53 4 2 S000402 G091 FPS 11 PC EU 13SEP2015
9 13SEP2015:00:51:07 13SEP2015:01:04:22 $59.55 5 1 S000501 G088 Simulation 183 Console ASIA 13SEP2015
10 13SEP2015:17:15:57 13SEP2015:17:56:06 $85.35 5 2 S000502 G041 Simulation 288 PC ASIA 13SEP2015
11 12SEP2015:22:56:56 12SEP2015:23:40:13 $81.78 6 1 S000601 G049 Strategy 406 Console NA 12SEP2015
12 13SEP2015:13:03:57 13SEP2015:14:53:23 $78.24 6 2 S000602 G052 RPG 460 Console EU 13SEP2015
13 12SEP2015:22:30:19 12SEP2015:23:08:35 $17.08 6 3 S000603 G034 MOBA 319 Mobile NA 12SEP2015
14 13SEP2015:12:12:03 13SEP2015:13:16:48 $10.51 7 1 S000701 G091 FPS 367 PC SA 13SEP2015
15 13SEP2015:00:56:14 13SEP2015:02:52:42 $63.10 8 1 S000801 G041 Simulation 461 Console EU 13SEP2015
16 13SEP2015:11:43:14 13SEP2015:12:37:22 $9.80 8 2 S000802 G085 RPG 228 Console ASIA 13SEP2015
17 13SEP2015:07:24:34 13SEP2015:08:07:46 $48.15 8 3 S000803 G005 FPS 139 PC SA 13SEP2015
18 13SEP2015:19:19:27 13SEP2015:19:55:22 $27.07 9 1 S000901 G007 MOBA 103 PC NA 13SEP2015
19 13SEP2015:08:18:36 13SEP2015:10:13:16 $97.39 9 2 S000902 G035 Strategy 261 PC NA 13SEP2015
20 13SEP2015:03:44:04 13SEP2015:04:07:12 $59.52 9 3 S000903 G038 FPS 490 Mobile SA 13SEP2015
21 13SEP2015:06:28:54 13SEP2015:07:48:24 $10.47 10 1 S001001 G015 Simulation 48 Console NA 13SEP2015
22 13SEP2015:00:32:35 13SEP2015:02:17:10 $23.05 11 1 S001101 G033 RPG 446 Mobile SA 13SEP2015
23 13SEP2015:09:59:56 13SEP2015:10:50:31 $71.62 11 2 S001102 G047 FPS 472 PC EU 13SEP2015
24 13SEP2015:08:05:32 13SEP2015:09:02:48 $90.99 11 3 S001103 G079 Strategy 365 Console NA 13SEP2015
25 13SEP2015:14:59:00 13SEP2015:15:33:30 $35.76 12 1 S001201 G023 Strategy 238 Console EU 13SEP2015
26 13SEP2015:23:21:54 13SEP2015:23:26:22 $99.04 12 2 S001202 G021 FPS 302 Mobile NA 13SEP2015
27 12SEP2015:22:16:07 12SEP2015:22:17:54 $99.66 13 1 S001301 G007 MOBA 258 Mobile EU 12SEP2015
28 13SEP2015:01:38:00 13SEP2015:02:20:06 $48.28 14 1 S001401 G021 RPG 474 Mobile NA 13SEP2015
29 13SEP2015:15:48:13 13SEP2015:17:23:36 $97.26 14 2 S001402 G100 FPS 207 PC NA 13SEP2015
30 13SEP2015:08:19:08 13SEP2015:10:01:45 $7.54 14 3 S001403 G039 Simulation 272 Console NA 13SEP2015
31 13SEP2015:03:29:28 13SEP2015:05:08:24 $23.52 15 1 S001501 G014 RPG 279 Mobile EU 13SEP2015
32 13SEP2015:07:13:02 13SEP2015:08:36:33 $66.59 15 2 S001502 G072 Simulation 306 Mobile SA 13SEP2015
33 13SEP2015:12:47:18 13SEP2015:14:04:39 $95.40 15 3 S001503 G072 MOBA 219 PC SA 13SEP2015
34 12SEP2015:21:21:44 12SEP2015:22:04:49 $95.55 16 1 S001601 G035 Strategy 73 Mobile SA 12SEP2015
35 13SEP2015:14:02:54 13SEP2015:15:35:38 $67.32 17 1 S001701 G022 FPS 175 PC EU 13SEP2015
36 13SEP2015:17:56:20 13SEP2015:18:51:24 $65.43 18 1 S001801 G048 Simulation 240 Console ASIA 13SEP2015
37 12SEP2015:22:32:46 12SEP2015:23:42:06 $43.66 18 2 S001802 G042 Strategy 183 Mobile ASIA 12SEP2015
38 13SEP2015:03:33:57 13SEP2015:04:33:07 $9.11 19 1 S001901 G084 FPS 469 Console ASIA 13SEP2015
39 13SEP2015:07:08:08 13SEP2015:08:08:42 $30.12 20 1 S002001 G097 RPG 40 PC ASIA 13SEP2015


proc sql;

    select session_date, count(*) as sessions_count

    from sessions_time

    group by session_date

    order by session_date;

quit;

Output:

session_date sessions_count
12SEP2015 6
13SEP2015 33

/*Peak Gaming Hours*/

data sessions_hour;

    set gaming_sessions;

    session_hour = hour(timepart(session_start));

run;

proc print;run;

Output:

Obs session_start session_end in_game_purchases user_id session_num session_id game_id game_genre actions_performed device_type region session_hour
1 13SEP2015:20:08:08 13SEP2015:20:49:10 $12.11 1 1 S000101 G006 MOBA 373 PC NA 20
2 13SEP2015:16:15:11 13SEP2015:16:20:19 $86.33 2 1 S000201 G028 MOBA 42 Mobile ASIA 16
3 13SEP2015:11:34:32 13SEP2015:12:21:22 $71.48 2 2 S000202 G084 FPS 470 PC EU 11
4 13SEP2015:17:11:19 13SEP2015:17:59:35 $8.51 2 3 S000203 G049 Strategy 31 PC NA 17
5 13SEP2015:20:28:08 13SEP2015:20:59:26 $49.02 3 1 S000301 G081 Strategy 183 Mobile EU 20
6 12SEP2015:20:52:45 12SEP2015:21:22:28 $57.36 3 2 S000302 G081 MOBA 440 Console SA 20
7 13SEP2015:12:22:36 13SEP2015:14:00:25 $84.76 4 1 S000401 G031 FPS 25 PC ASIA 12
8 13SEP2015:20:33:19 13SEP2015:21:03:00 $78.53 4 2 S000402 G091 FPS 11 PC EU 20
9 13SEP2015:00:51:07 13SEP2015:01:04:22 $59.55 5 1 S000501 G088 Simulation 183 Console ASIA 0
10 13SEP2015:17:15:57 13SEP2015:17:56:06 $85.35 5 2 S000502 G041 Simulation 288 PC ASIA 17
11 12SEP2015:22:56:56 12SEP2015:23:40:13 $81.78 6 1 S000601 G049 Strategy 406 Console NA 22
12 13SEP2015:13:03:57 13SEP2015:14:53:23 $78.24 6 2 S000602 G052 RPG 460 Console EU 13
13 12SEP2015:22:30:19 12SEP2015:23:08:35 $17.08 6 3 S000603 G034 MOBA 319 Mobile NA 22
14 13SEP2015:12:12:03 13SEP2015:13:16:48 $10.51 7 1 S000701 G091 FPS 367 PC SA 12
15 13SEP2015:00:56:14 13SEP2015:02:52:42 $63.10 8 1 S000801 G041 Simulation 461 Console EU 0
16 13SEP2015:11:43:14 13SEP2015:12:37:22 $9.80 8 2 S000802 G085 RPG 228 Console ASIA 11
17 13SEP2015:07:24:34 13SEP2015:08:07:46 $48.15 8 3 S000803 G005 FPS 139 PC SA 7
18 13SEP2015:19:19:27 13SEP2015:19:55:22 $27.07 9 1 S000901 G007 MOBA 103 PC NA 19
19 13SEP2015:08:18:36 13SEP2015:10:13:16 $97.39 9 2 S000902 G035 Strategy 261 PC NA 8
20 13SEP2015:03:44:04 13SEP2015:04:07:12 $59.52 9 3 S000903 G038 FPS 490 Mobile SA 3
21 13SEP2015:06:28:54 13SEP2015:07:48:24 $10.47 10 1 S001001 G015 Simulation 48 Console NA 6
22 13SEP2015:00:32:35 13SEP2015:02:17:10 $23.05 11 1 S001101 G033 RPG 446 Mobile SA 0
23 13SEP2015:09:59:56 13SEP2015:10:50:31 $71.62 11 2 S001102 G047 FPS 472 PC EU 9
24 13SEP2015:08:05:32 13SEP2015:09:02:48 $90.99 11 3 S001103 G079 Strategy 365 Console NA 8
25 13SEP2015:14:59:00 13SEP2015:15:33:30 $35.76 12 1 S001201 G023 Strategy 238 Console EU 14
26 13SEP2015:23:21:54 13SEP2015:23:26:22 $99.04 12 2 S001202 G021 FPS 302 Mobile NA 23
27 12SEP2015:22:16:07 12SEP2015:22:17:54 $99.66 13 1 S001301 G007 MOBA 258 Mobile EU 22
28 13SEP2015:01:38:00 13SEP2015:02:20:06 $48.28 14 1 S001401 G021 RPG 474 Mobile NA 1
29 13SEP2015:15:48:13 13SEP2015:17:23:36 $97.26 14 2 S001402 G100 FPS 207 PC NA 15
30 13SEP2015:08:19:08 13SEP2015:10:01:45 $7.54 14 3 S001403 G039 Simulation 272 Console NA 8
31 13SEP2015:03:29:28 13SEP2015:05:08:24 $23.52 15 1 S001501 G014 RPG 279 Mobile EU 3
32 13SEP2015:07:13:02 13SEP2015:08:36:33 $66.59 15 2 S001502 G072 Simulation 306 Mobile SA 7
33 13SEP2015:12:47:18 13SEP2015:14:04:39 $95.40 15 3 S001503 G072 MOBA 219 PC SA 12
34 12SEP2015:21:21:44 12SEP2015:22:04:49 $95.55 16 1 S001601 G035 Strategy 73 Mobile SA 21
35 13SEP2015:14:02:54 13SEP2015:15:35:38 $67.32 17 1 S001701 G022 FPS 175 PC EU 14
36 13SEP2015:17:56:20 13SEP2015:18:51:24 $65.43 18 1 S001801 G048 Simulation 240 Console ASIA 17
37 12SEP2015:22:32:46 12SEP2015:23:42:06 $43.66 18 2 S001802 G042 Strategy 183 Mobile ASIA 22
38 13SEP2015:03:33:57 13SEP2015:04:33:07 $9.11 19 1 S001901 G084 FPS 469 Console ASIA 3
39 13SEP2015:07:08:08 13SEP2015:08:08:42 $30.12 20 1 S002001 G097 RPG 40 PC ASIA 7


proc sql;

    select session_hour, count(*) as sessions_count

    from sessions_hour

    group by session_hour

    order by sessions_count desc;

quit;

Output:

session_hour sessions_count
22 4
20 4
8 3
17 3
3 3
7 3
12 3
0 3
14 2
11 2
19 1
9 1
16 1
15 1
13 1
23 1
1 1
6 1
21 1


Find A Mistake and Comment It:

proc sql;

    select count(*) as total_sessions,

           mean(intck(second, session_start, session_end))/60 as avg_duration_minutes

    from gaming_sessions;

quit;



PRACTICE AND COMMENT YOUR CODE: 

--->PLEASE FOLLOW OUR BLOG FOR MORE UPDATES.

PLEASE FOLLOW OUR TELEGRAM CHANNEL CLICK HERE

PLEASE FOLLOW OUR FACEBOOK PAGE  CLICK HERE

Comments