turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- How to proc freq for all variables in a macro

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

a month ago

Dear,

I am validating a data set. I want to check for any missing values and possible values and outliers for each variables in the data set.

I am running proc freq for each variable. I just want to know any better way to do it as my lab data set has more than million obs and 100 variables.

```
data one;
input a b $3 c$5;
datalines;
1 a b
2 c
3
4 b d
5 c e
6 d f
7 g
8 e
;
proc freq;
tables a;
run;
proc freq;
tables b;
run;
proc freq;
tables c;
run;
```

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to knveraraju91

a month ago

Why not just use:

```
data one;
input a b $3 c$5;
datalines;
1 a b
2 c
3
4 b d
5 c e
6 d f
7 g
8 e
;
proc freq;
tables _all_;
run;
```

Art, CEO, AnalystFinder.com

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to knveraraju91

a month ago

If you have variables that are more of a measurement than a category such as height, weight, monetary values (price/ sale and similar), you might want to look at them in terms of means, deviations and extremes, such as Proc Univariate provides as with "millions of observations" you might find yourself attempting to look through 100,000s of lines in a single table.

Or one approach if you are not concerned about any specific single record's value but know the expected or desired range of values is to create custom formats of "valid" range of data values for specific variables. Example:

proc format library=work; value expectedage 13 - 16='Valid' other = 'Invalid'; run; proc freq data=sashelp.class; tables age; format age expectedage.; run;

Which at least makes output tables easier to interpret in some forms.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to knveraraju91

4 weeks ago

Note that in the above replies, no macros are needed. Don't resort to macros unless you are convinced that there is no non-macro solution available.

--

Paige Miller

Paige Miller