AFHood Group Blog The thoughtless yammerings of marketing junkies..

3Mar/090

SAS Proc Freq and crosstab basics

When thinking of the basic tools available in SAS, Proc Freq is on the list. This is one of those tools that can help you wrap your brain around your data. As an analyst, you should constantly be asking, what does my data look like. And this is where proc freq does the job.

So here is your data:

sashelp_flags

You want to know, what are the projects in this dataset and how many records are associated with each??

Proc Freq data=sashelp.flags;

table project;

run;

And here is your output:

flags_freq_output

Low and behold, it is the only project in the dataset with 220 records.

Lets take this very basic example one step further and say we want to crosstab this dataset. Pivot the dataset if you will. We want to see a distribution of descriptions by file. That code would look like this:

Proc Freq data=sashelp.flags;

table file*descript;

run;

And the output like this:

freq_crosstab_output

The order of the variables in the table statement determine how the cross-tab is setup. Try this code on your data. This is one of the most elementary ways to understand your datasets.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.