49. PROC FREQ | OUT OPTION

                                            PROC FREQ | OUT OPTION


-->OUTPUT DATASETS:

PROC FREQ produces output data sets using two different methods.

-->1.The TABLES statement with an OUT= option is used to create a data set with frequencies and                percentages.

HERE SYNTAX IS:  TABLES variables / OUT=SAS-data-set <options>;

-->2.The OUTPUT statement with an OUT= option is used to create a data set with specified statistics            such as the chi-square statistic.

HERE SYNTAX IS:  OUTPUT OUT=SAS-data-set <options>;


HERE WE ARE LEARNING ABOUT OUT OPTION....

The OUT= option in the TABLES statement creates an output data set with the following variables:

1. BY variables

2. TABLES statement variables

3. The automatic variables COUNT and PERCENT

4.Other frequency and percentage variables requested with options in the TABLES statement

HERE SYNTAX IS:  TABLES variables / OUT=SAS-data-set <options>;

-->If more than one table request appears in the TABLES statement, the contents of the data set correspond to the last table request.

-->HERE WE CAN ALSO USE NOPRINT OPTION IT WILL NOT PRINT TO OUTPUT.


ONE-WAY FREQ:


PROC FREQ DATA=SASUSER.CLASS2 NOPRINT;

 TABLE NAME AGE / OUT=WORK.FREQ1;

RUN;


LOG:

NOTE: There were 19 observations read from the data set SASUSER.CLASS2.

NOTE: The data set WORK.FREQ1 has 6 observations and 3 variables.

NOTE: PROCEDURE FREQ used (Total process time):

      real time           0.63 seconds

      cpu time            0.01 seconds


PROC PRINT DATA=WORK.FREQ1;RUN;


LOG:

NOTE: Writing HTML Body file: sashtml.htm

NOTE: There were 6 observations read from the data set WORK.FREQ1.

NOTE: PROCEDURE PRINT used (Total process time):

      real time           2.46 seconds

      cpu time            0.29 seconds


RESULT:

        The SAS System

Obs Age COUNT PERCENT
1 11 2 10.5263
2 12 5 26.3158
3 13 3 15.7895
4 14 4 21.0526
5 15 4 21.0526
6 16 1 5.2632


TWO-WAY FREQ:

PROC FREQ DATA=SASUSER.CLASS2 NOPRINT;

 TABLE NAME*AGE / OUT=WORK.FREQ1;

RUN;

LOG:

NOTE: There were 19 observations read from the data set SASUSER.CLASS2.
NOTE: The data set WORK.FREQ1 has 19 observations and 4 variables.
NOTE: PROCEDURE FREQ used (Total process time):
      real time           0.45 seconds
      cpu time            0.04 seconds


PROC PRINT DATA=WORK.FREQ1;RUN;

LOG:

NOTE: There were 19 observations read from the data set WORK.FREQ1.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds


RESULT:

           The SAS System

Obs Name Age COUNT PERCENT
1 Alfred 14 1 5.26316
2 Alice 13 1 5.26316
3 Barbara 13 1 5.26316
4 Carol 14 1 5.26316
5 Henry 14 1 5.26316
6 James 12 1 5.26316
7 Jane 12 1 5.26316
8 Janet 15 1 5.26316
9 Jeffrey 13 1 5.26316
10 John 12 1 5.26316
11 Joyce 11 1 5.26316
12 Judy 14 1 5.26316
13 Louise 12 1 5.26316
14 Mary 15 1 5.26316
15 Philip 16 1 5.26316
16 Robert 12 1 5.26316
17 Ronald 15 1 5.26316
18 Thomas 11 1 5.26316
19 William 15 1 5.26316


-->PLEASE READ AND COMMENT THE BLOG...

--PLEASE FOLLOW THE BLOG FOR MORE UPDATES...

--FOLLOW US IN FACEBOOK SASALL4YOU AND JOIN ...

--JOIN US IN FACEBOOK AND TELEGRAM  CHANNEL FOR MORE UPDATES

   CLICK HERE: https://t.me/SasAll4You







Comments