Hi,
I downloaded PUMS 2020 household level data, and was trying to figure out the median household income (variable hincp) of the New York state.
It works with the code: tabstat hincp, stat (median), [fweight=wgtp]
But since I also want to calculate the margin of error, I set up the data as:
svyset [pw=wgtp], sdrweight(wgtp1-wgtp80) vce(sdr)
And after that, I can run the command to calculate the average of household income by:
svy mean hincp
However, when I try to calculate the median household income, it always returns:
. svy sdr : proportion hincp
(running proportion on estimation sample)
hincp: factor variables may not contain negative values
an error occurred when sdr executed proportion
r(452);
Can anybody help with that? Thank you so much!
I downloaded PUMS 2020 household level data, and was trying to figure out the median household income (variable hincp) of the New York state.
It works with the code: tabstat hincp, stat (median), [fweight=wgtp]
But since I also want to calculate the margin of error, I set up the data as:
svyset [pw=wgtp], sdrweight(wgtp1-wgtp80) vce(sdr)
And after that, I can run the command to calculate the average of household income by:
svy mean hincp
However, when I try to calculate the median household income, it always returns:
. svy sdr : proportion hincp
(running proportion on estimation sample)
hincp: factor variables may not contain negative values
an error occurred when sdr executed proportion
r(452);
Can anybody help with that? Thank you so much!
Comment