BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

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;

3 REPLIES 3
art297
Opal | Level 21

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

 

ballardw
Super User

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.

 

PaigeMiller
Diamond | Level 26

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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 11706 views
  • 7 likes
  • 4 in conversation