Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2023-01-14 04:39:18
Size: 1391
Comment:
Revision 6 as of 2023-03-30 15:05:38
Size: 2182
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

A procudure for printing one-way frequency tables up to n-way crosstabs.
Line 31: Line 33:
  tables VAR1*VAR2;   tables STUBVAR*BANNERVAR;
Line 35: Line 37:
To suppress certain aspects of the frequency table, specify the corresponding supresion option. For example, to suppress cumulative frequencies, try: To suppress certain aspects of the frequency table, specify the corresponding suppression option. For example, to suppress cumulative frequencies, try:
Line 45: Line 47:
||'''Option'''||'''Meaning'''         ||
||`nocum` ||suppress cumulative percentages         ||
||`nopercent` ||suppress cell percentages
||
||`norow` ||suppress row percentages         ||
||`nocol` ||suppress column percentages         ||
||`crosslist` ||trigger nested list display for crosstabs         ||
||`list` ||as above and includes first level value on each row||
||'''Option'''||'''Meaning''' ||
||`nocum` ||suppress cumulative percentages ||
||`nopercent` ||suppress cell percentages
||
||`norow` ||suppress row percentages ||
||`nocol` ||suppress column percentages ||
||`crosslist` ||trigger nested list display for crosstabs ||
||`list` ||as above and includes `STUBVAR` on each row||
Line 59: Line 61:
----



== Tables Out ==

To store the frequencies displayed on a table, try:

{{{
proc freq data=LIBREF.TABLE order=freq;
  tables VARLIST / nocum out=LIBREF.NEWTABLE;
run;
}}}

`NEWTABLE` will contain the enw variables `COUNT` and `PERCENT`.

----



== Plot ==

To plot the frequencies percentages displayed on a table, try:

{{{
ods graphics on;
ods select freqplot;
proc freq data=LIBREF.TABLE order=freq;
  tables VARLIST / plots=freqplot(orient=horizontal scale=percent);
run;
}}}

To plot a crosstab with percentages, try:

{{{
ods graphics on;
ods select freqplot;
proc freq data=LIBREF.TABLE order=freq;
  tables STUBVAR*BANNERVAR / plots=freqplot(groupby=row orient=horizontal scale=grouppercent);
run;
}}}

SAS Freq

A procudure for printing one-way frequency tables up to n-way crosstabs.


Usage

To display frequencies of variables, try:

proc freq data=LIBREF.TABLE order=freq;
  tables VARLIST;
run;

To list unique values, add the nlevel option to the procedure.

Tables Statement

The TABLES statement creates a table for each variable specified in VARLIST.

To create a crosstab, try:

proc freq data=LIBREF.TABLE;
  tables STUBVAR*BANNERVAR;
run;

To suppress certain aspects of the frequency table, specify the corresponding suppression option. For example, to suppress cumulative frequencies, try:

proc freq data=LIBREF.TABLE order=freq;
  tables VARLIST / nocum;
run;

The options are:

Option

Meaning

nocum

suppress cumulative percentages

nopercent

suppress cell percentages

norow

suppress row percentages

nocol

suppress column percentages

crosslist

trigger nested list display for crosstabs

list

as above and includes STUBVAR on each row

By Statement

The BY statement specifies one or more variables for which the PROC FREQ should be split.


Tables Out

To store the frequencies displayed on a table, try:

proc freq data=LIBREF.TABLE order=freq;
  tables VARLIST / nocum out=LIBREF.NEWTABLE;
run;

NEWTABLE will contain the enw variables COUNT and PERCENT.


Plot

To plot the frequencies percentages displayed on a table, try:

ods graphics on;
ods select freqplot;
proc freq data=LIBREF.TABLE order=freq;
  tables VARLIST / plots=freqplot(orient=horizontal scale=percent);
run;

To plot a crosstab with percentages, try:

ods graphics on;
ods select freqplot;
proc freq data=LIBREF.TABLE order=freq;
  tables STUBVAR*BANNERVAR / plots=freqplot(groupby=row orient=horizontal scale=grouppercent);
run;


CategoryRicottone

SAS/Freq (last edited 2023-03-30 15:05:38 by DominicRicottone)