Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Question dealing with Missing Values and Tabulating


From   "Sinha, Ashish" <[email protected]>
To   <[email protected]>
Subject   st: Question dealing with Missing Values and Tabulating
Date   Thu, 26 May 2005 17:46:11 +0200

Very sorry, I miss-clicked and sent the message before it was completed
-- here is the actual one.


Thank you for all your help before, I now am finishing up a program for
crunching some data.  I had two last issues that I can`t seem to resolve
and would appreciate any help or suggestions.  Thank you for your time!

1. Missing Values

I am currently running a do file that takes data from an excel file and
processes it into different outputs.  I wanted to rid myself of missing
values so they would not affect my percentages.  The problem I had was
after using phrases such as (drop if(missing)) it would drop that data
for all other tabulations. 

For example:

label define content 1 "Strongly   agree" 2 "Agree" 3 "Neither agree
nor disagree" 4 "Disagree" 5 "Strongly   disagree"
encode lessoncontent~o, gen(content) 
recode content (1 2 = 2) (4 5 = 4), gen(content2) 
label values content2 content
tab content2

label define detail 1 "Strongly   agree" 2 "Agree" 3 "Neither agree
nor disagree" 4 "Disagree" 5 "Strongly   disagree"
encode detailprovide~p, gen(detail) 
recode detail (1 2 = 2) (4 5 = 4), gen(detail2) 
label values detail2 detail
tab detail2 

label define difficulty 1 "Strongly   agree" 2 "Agree" 3 "Neither agree
nor disagree" 4 "Disagree" 5 "Strongly   disagree"
encode thelevelofdif~s, gen(difficulty) 
recode difficulty (1 2 = 2) (4 5 = 4), gen(difficulty2) 
label values difficulty2 difficulty
tab difficulty2

-- is there a statement that will allow me to drop the missing values
for each variable without affecting the results of the other data?


2. Tabulating

I had a chart of two variables.  I cross-tab them using collapse, but I
cannot seem to get the output I want.  The output I want is to compare
the two variables and give percentages from one variable to another. 
Right Now I get:

tab status haveyoureceiv~t if (status==1) | (status==2) | (status==3) |
(status==4)

                      |   Have you received
                      | more than 6 hours of
  Please tick the box |  training in injury
  that best describes |    prevention and
         your current |        control
   status/affiliation |        no        yes |     Total
----------------------+----------------------+----------
Government official/e |        73         36 |       109 
Injury prevention ser |        16         20 |        36 
Injury response servi |        12          4 |        16 
              Student |       295         24 |       319 
----------------------+----------------------+----------
                Total |       396         84 |       480

Is it also possible to output the percent that say yes and no for each
row?


Thank you again

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index