Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

How do I tabulate a variable in Stata to show all values that are in my sample, even if they're not yet in the dataset?

$
0
0

I am trying to tabulate a variable for a report at work to show the completion rate by municipality of a survey that is currently in the field. A dataset is downloaded each week showing all the responses so far, and I need to generate a table that shows frequencies for all the municipalities in our sample, even if they are zero. Using the missing option doesn't work because the dataset the report is made from doesn't have any way of telling stata what the overall sample of municipalities is.

Is there a way to get it to show zero for values that aren't in the dataset, based on a list of values in the overall sample? I'm competent in R so if someone has a suggestion for how to do this in R that would be good too.

So far this is my code:

convert string variable to numeric variable with value labels

    encode municipality_name, gen(municipality)

export survey completion by municipality to .doc file

    asdoc tab municipality, mis

Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>