Help using Base SAS procedures

how to handle missing values in proc freq

Accepted Solution Solved
Reply
Contributor
Posts: 57
Accepted Solution

how to handle missing values in proc freq

Dear friends,

I am Anilkumar from Hyderabad, India i am facing a problem with missing values when i'm going to prepare tables in proc freq even i used missing option also the table is coming like this. so if i delete missing valyues in the particular variable it will effect to other variables also. so what is the solution.

i request you to look at my codes and output once.

proc freq data=nfhs_05.nonpreg_women;

where V024=29;

table  V025*Anemia_statusnpw/norow nocol missing   ;

table  V013*Anemia_statusnpw/norow nocol missing ;

table  V106*Anemia_statusnpw/norow nocol missing ;

table  V130*Anemia_statusnpw/norow nocol missing ;

table  Age_group * Anemia_statusnpw/norow nocol missing ;

format V025 F00009_.;

format V013 F00001_.;

format V106 F00019_.;

format V130 F00609_.;

format Age_group agewomen_.;

weight weights;

run;

Frequency
Percent

         
Urban
411.757
5.78
78.9311
1.11
527.523
7.41
544.624
7.65
1335.25
18.75
2898.09
40.70
Rural
354.752
4.98
198.139
2.78
940.865
13.21
851.88
11.96
1876.98
26.36
4222.62
59.30
Total
766.51
10.76
277.07
3.89
1468.39
20.62
1396.5
19.61
3212.24
45.11
7120.71
100.00

Tanks for your help....

thanks and regards,

Anil


Accepted Solutions
Solution
‎12-01-2014 10:04 PM
Contributor
Posts: 25

Re: how to handle missing values in proc freq

Hi Anil,

I think should use the MISSPRINT option rather than MISSING option.  Here's what the Proc Freq documentation says:

MISSPRINT

displays missing value frequencies in frequency or crosstabulation tables but does not include them in computations of percentages or statistics.

MISSING

treats missing values as a valid nonmissing level for all TABLES variables. Displays missing levels in frequency and crosstabulation tables and includes them in computations of percentages and statistics.

Eliminating missing values with a WHERE statement will affect other variables also, unless you run them in separate Proc Freq steps.

I've always found it useful to understand the missing value frequencies, even though I wasn't using them in computations.

Cheers,

Dave

View solution in original post


All Replies
Super User
Super User
Posts: 7,430

Re: how to handle missing values in proc freq

Sorry, what is the problem?  I see no missings in that table.  Can you provide test data/expected output also.

Contributor
Posts: 57

Re: how to handle missing values in proc freq

Hi this is what i got results

i need to remove missing values in tables mentioned as a dot in 2nd column because its also contributing to the total value so the results will go wrong.

V013(Age 5-yearAnemia_status
groups)    .1234Total
15-19136.44741.8884265.464269.619597.1451310.56
1.920.593.733.798.3918.4
20-24149.60347.3045281.121232.218571.9421282.19
2.10.663.953.268.0318.01
25-29158.11649.8065220.12251.434527.9141207.39
2.220.73.093.537.4116.96
30-34107.97237.5547223.551235.415470.0851074.58
1.520.533.143.316.615.09
35-3982.565443.8742174.801169.643448.908919.792
1.160.622.452.386.312.92
40-4486.64133.3251184.268150.581323.863778.678
1.220.472.592.114.5510.94
45-4945.164723.3171119.06387.5943272.379547.517
0.630.331.671.233.837.69
Total766.51277.071468.391396.53212.247120.71
10.763.8920.6219.6145.11100

the codes are

proc freq data=nfhs_05.nonpreg_women;

where V024=29;

table  V025*Anemia_statusnpw/norow nocol missing   ;

table  V013*Anemia_statusnpw/norow nocol missing ;

table  V106*Anemia_statusnpw/norow nocol missing ;

table  V130*Anemia_statusnpw/norow nocol missing ;

table  Age_group * Anemia_statusnpw/norow nocol missing ;

format V025 F00009_.;

format V013 F00001_.;

format V106 F00019_.;

format V130 F00609_.;

format Age_group agewomen_.;

weight weights;

run;

thanks

anil

Super User
Super User
Posts: 7,430

Re: how to handle missing values in proc freq

So you can just have a step before which drops data where that group (don't know the variable name) is missing, i.e. assuming anemia status groups is a_group:

data want;

     set have;

     where a_group ne .;

run;

proc freq...;

run;

Solution
‎12-01-2014 10:04 PM
Contributor
Posts: 25

Re: how to handle missing values in proc freq

Hi Anil,

I think should use the MISSPRINT option rather than MISSING option.  Here's what the Proc Freq documentation says:

MISSPRINT

displays missing value frequencies in frequency or crosstabulation tables but does not include them in computations of percentages or statistics.

MISSING

treats missing values as a valid nonmissing level for all TABLES variables. Displays missing levels in frequency and crosstabulation tables and includes them in computations of percentages and statistics.

Eliminating missing values with a WHERE statement will affect other variables also, unless you run them in separate Proc Freq steps.

I've always found it useful to understand the missing value frequencies, even though I wasn't using them in computations.

Cheers,

Dave

Contributor
Posts: 57

Re: how to handle missing values in proc freq

Hi Dave,

Thanks for the help i thought missprint will works only in proc tabulate otherwise i would have applied this before.

anyway thanks a lot..

Anil

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 324 views
  • 0 likes
  • 3 in conversation