1
votes

I have a large SAS dataset which contain both numeric and character variables. I can use proc means to calculate descriptive statistics for numeric variables. For character variables, I want to know the unique values and their frequencies and missing values. I want to call all character variables at once and don't want to specify each one.

How do I do this?

For e.g the following datastep calls all numeric variables at once and calculate their summary statistics.

proc means data = dat1;
var _numeric_;
run;

I verified that the following doesn't work:

proc freq data = dat1;
tables _character_;
run;

Thanks!

2
Ever get to the bottom of why that proc freq didn't work?Snorex

2 Answers

3
votes

Your attempt was correct, for your stated problem - the below works correctly to produce a frequency of each character variable.

proc freq data=sashelp.class;
tables _character_;
run;

Potential pitfalls with this include the possibility that a format is making numeric variables look like character variables.

0
votes
proc freq data=sashelp.class;
    tables _char_;
run;

Can do the same thing for you.