Chapter Contents |
Previous |
Next |
The FREQ Procedure |
The following DATA step statements store raw data in a SAS data set:
data Raw; input Subject $ R C @@; datalines; 01 1 1 02 1 1 03 1 1 04 1 1 05 1 1 06 1 2 07 1 2 08 1 2 09 2 1 10 2 1 11 2 1 12 2 1 13 2 2 14 2 2 14 2 2 ;
You can store the same data as cell counts using the following DATA step statements:
data CellCounts; input R C Count @@; datalines; 1 1 5 1 2 3 2 1 4 2 2 3 ;
The variable R contains the values for the rows, and the variable C contains the values for the columns. The Count variable contains the cell count for each row and column combination.
Both the Raw data set and the CellCounts data set produce identical frequency counts, two-way tables, and statistics. With the CellCounts data set, you must use a WEIGHT statement to specify that the Count variable contains cell counts. For example, to create a two-way crosstabulation table, submit the following statements:
proc freq data=CellCounts; weight Count; tables R*C; run;
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.