The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » Stunting Discrepancies with SL Reports (Calculated stunting prevalence rates differ from those in the Sierra Leone 2008 report)
Re: Stunting Discrepancies with SL Reports [message #23952 is a reply to message #23951] Thu, 20 January 2022 13:51 Go to previous messageGo to previous message
Shireen-DHS is currently offline  Shireen-DHS
Messages: 140
Registered: August 2020
Location: USA
Senior Member
Hello Amanda,

Using the PR file is correct for anthropometric indicators. Can you try the following R code below?
We will be posting the R code for all nutrition indicators on our GitHub site soon. Here is what we have available in R so far (https://github.com/DHSProgram/DHS-Indicators-R). We have all the indicators coded in Stata and SPSS if you would like to check the code there as well.

Thank you.
Best,
Shireen Assaf
The DHS Program

# libraries
library(tidyverse) # most variable creation here uses tidyverse
library(haven) # used for Haven labeled DHS variables
library(labelled) # used for Haven labeled variable creation
library(expss) # for creating tables with Haven labeled data
library(naniar) # to use replace_with_na function
library(xlsx) # for exporting to excel

# //Severely stunted
PRdata <- PRdata %>%
mutate(nt_ch_sev_stunt =
case_when(
hv103==1 & hc70< -300 ~ 1 ,
hv103==1 & hc70>= -300 ~ 0 ,
hc70>=9996 ~ 99)) %>%
replace_with_na(replace = list(nt_ch_sev_stunt = c(99))) %>%
set_value_labels(nt_ch_sev_stunt = c("Yes" = 1, "No"=0 )) %>%
set_variable_labels(nt_ch_sev_stunt = "Severely stunted child under 5 years")

# //Stunted
PRdata <- PRdata %>%
mutate(nt_ch_stunt =
case_when(
hv103==1 & hc70< -200 ~ 1 ,
hv103==1 & hc70>= -200 ~ 0 ,
hc70>=9996 ~ 99)) %>%
replace_with_na(replace = list(nt_ch_stunt = c(99))) %>%
set_value_labels(nt_ch_stunt = c("Yes" = 1, "No"=0 )) %>%
set_variable_labels(nt_ch_stunt = "Stunted child under 5 years")

PRdata <- PRdata %>%
mutate(wt = hv005/1000000)

table_temp <- PRdata %>%
calc_cro_rpct(
cell_vars = list(hc27, hv025, hv024, hv270, total()),
col_vars = list(nt_ch_sev_stunt, nt_ch_stunt),
weight = wt,
total_label = "Weighted N",
total_statistic = "w_cases",
total_row_position = c("below"),
expss_digits(digits=1)) %>%
set_caption("Child's anthropometric indicators")
write.xlsx(table_temp, "Chap11_NT/Tables_nut_ch.xls", sheetName = "child_anthro", append=TRUE)
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IYCF indicators
Next Topic: MDD-W for Rwanda
Goto Forum:
  


Current Time: Fri Apr 26 21:06:11 Coordinated Universal Time 2024