BookmarkSubscribeRSS Feed
JinboZhao
Calcite | Level 5

Hi Guys,

 

I hope to get a data quality report which includes the following indicators:

var mean std min max N Q1 median Q3 IQ_Range n_low n_low_percent n_high n_high_percent n_far_low n_far_low_percent n_far_high n_far_high_percent null_rate missing missing_percent

 

Could anyone show me the respective code in SAS proc print, or proc freq, or other useful SAS procedure?

 

Many appreciation. 

6 REPLIES 6
JinboZhao
Calcite | Level 5

Thank you. I got most of them, but could not get the percentage ones. Could you help me?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Without some test data (in the form of a datastep) I can only give generals.  Percents are just count() / N, so you can do these in a datastep.  You may need to proc freq your data to get counts, merge that on.

JinboZhao
Calcite | Level 5

Hi, my dataset is like this:

IDOPENTIMECLOSETIMEGENDERGRADELOANSFLAG
198121FA1200Y
295115MB1300Y
396114MC1500N
499120FD1600Y
598107FE1700N

 

The following is the code I use:

proc means data=table n mean min max std q1 q3 qrange median nmiss ;
var _numeric_;
run;
proc freq data=table;
tables _character_;
run;

 

But the results for numeric variables do not include the percentages. Could you help me, as I want to get all those results in one report.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, I don't have time to write a whole report for you.  Use those procedures, then merge the required data together, and datastep to calculate any further numbers you need.

ballardw
Super User

One thing to consider for percentages is what is the numerator and denominator to be used. I don't believe you have specified that in any way clear enough. Likely the way will be to create the appropriate Sums in Proc means/summary and then in a data step calculate the percentages.

 

Or perhaps Proc Report or Tabulate using the data for a report will allow the percentage calculations.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 856 views
  • 0 likes
  • 3 in conversation