Proc Frequency or PROC FREQ, is a commonly utilized SAS procedure. To utilize this procedure, the basic form is:
PROC FREQ DATA = <nameofdataset>;
TABLE <columntosummarize>;
RUN;
TABLE Gender;
RUN;
RUN;
The default output that is produced from this code will display:
1. Each unique variable found within the specified column.
2. The number of occurrences of each variable.
3. The total percentage of the occurrence of each variable when weighed against the total number of occurrences.
4. The sum of frequency counts of the variable value, and all other values listed above it in the table.
5. The cumulative frequency of the value divided by the total number of observations.
If you wanted to output the summary results of multiple variable columns, you may specify the option within the Proc Freq procedure.
PROC FREQ DATA = <nameofdataset>;
TABLE <columntosummarize1> <columntosummarize2> <columntosummarize3>;
RUN;
Ex. DataSetA
PROC FREQ DATA = DataSetA;
TABLE Gender HairColor;
RUN;
1. Each unique variable found within the specified column.
2. The number of occurrences of each variable.
3. The total percentage of the occurrence of each variable when weighed against the total number of occurrences.
4. The sum of frequency counts of the variable value, and all other values listed above it in the table.
5. The cumulative frequency of the value divided by the total number of observations.
If you wanted to output the summary results of multiple variable columns, you may specify the option within the Proc Freq procedure.
PROC FREQ DATA = <nameofdataset>;
TABLE <columntosummarize1> <columntosummarize2> <columntosummarize3>;
RUN;
Ex. DataSetA
PROC FREQ DATA = DataSetA;
TABLE Gender HairColor;
RUN;
Additionally, you are given the option to enable various options that change the display of the data summary output.
Some of these options include:
Some of these options include:
NOPERCENT - which suppresses cell percentages.
NOCUM - which eliminates the cumulative frequency.
These options are invoked on the second line of the Proc Freq procedure.
NOCUM - which eliminates the cumulative frequency.
These options are invoked on the second line of the Proc Freq procedure.
PROC FREQ DATA = <nameofdataset>;
TABLE <columntosummarize1> <columntosummarize2> <columntosummarize3> / <option1> <option2> <option3>;
RUN;
Ex. DataSetA
PROC FREQ DATA = DataSetA>;
TABLE HairColor / NOCUM NOPERCENT;
RUN;
Two Way Tables
PROC FREQ DATA = <nameofdataset>;
TABLE <columntosummarize1> * <columntosummarize2>;
RUN;
Ex. DataSetA
PROC FREQ DATA = DataSetA;
TABLE Gender * HairColor;
RUN;
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.