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;
|
|
Tanks for your help....
thanks and regards,
Anil
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.
MISSINGtreats 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
Sorry, what is the problem? I see no missings in that table. Can you provide test data/expected output also.
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-year | Anemia_status | |||||
groups) | . | 1 | 2 | 3 | 4 | Total |
15-19 | 136.447 | 41.8884 | 265.464 | 269.619 | 597.145 | 1310.56 |
1.92 | 0.59 | 3.73 | 3.79 | 8.39 | 18.4 | |
20-24 | 149.603 | 47.3045 | 281.121 | 232.218 | 571.942 | 1282.19 |
2.1 | 0.66 | 3.95 | 3.26 | 8.03 | 18.01 | |
25-29 | 158.116 | 49.8065 | 220.12 | 251.434 | 527.914 | 1207.39 |
2.22 | 0.7 | 3.09 | 3.53 | 7.41 | 16.96 | |
30-34 | 107.972 | 37.5547 | 223.551 | 235.415 | 470.085 | 1074.58 |
1.52 | 0.53 | 3.14 | 3.31 | 6.6 | 15.09 | |
35-39 | 82.5654 | 43.8742 | 174.801 | 169.643 | 448.908 | 919.792 |
1.16 | 0.62 | 2.45 | 2.38 | 6.3 | 12.92 | |
40-44 | 86.641 | 33.3251 | 184.268 | 150.581 | 323.863 | 778.678 |
1.22 | 0.47 | 2.59 | 2.11 | 4.55 | 10.94 | |
45-49 | 45.1647 | 23.3171 | 119.063 | 87.5943 | 272.379 | 547.517 |
0.63 | 0.33 | 1.67 | 1.23 | 3.83 | 7.69 | |
Total | 766.51 | 277.07 | 1468.39 | 1396.5 | 3212.24 | 7120.71 |
10.76 | 3.89 | 20.62 | 19.61 | 45.11 | 100 |
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
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;
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.
MISSINGtreats 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
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
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.