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

st: I'm sorry to do this again, but...


From   Jon Ebeling <jebeling@rocko.lab.csuchico.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: I'm sorry to do this again, but...
Date   Sat, 18 Sep 2004 09:55:38 -0700

I have tried using a suggestion from some of the listees:


. generate hour2 = real (hours)
real not found
r(111);


Then I tried using :


. destring hours, replace
hours already numeric; no replace

While the first procedure seemed reasonable but would not yield what I want, the second is true, but it again does not yield what I want. I want to be able to see the numeric values when I run a tab on hours.

Here is what the underlying numeric values are:


. sort secnum

. by secnum: sum hours

----------------------------------------------------------------------------------------------------------
-> secnum = 1 cathy

Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
hours | 1 89 . 89 89

----------------------------------------------------------------------------------------------------------
-> secnum = 2 hassan

Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
hours | 1 12 . 12 12

----------------------------------------------------------------------------------------------------------
-> secnum = 3 freddi

Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
hours | 1 24 . 24 24

----------------------------------------------------------------------------------------------------------
-> secnum = 9

Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
hours | 1 23 . 23 23

I thought I could use a replace command for each but if the data base is large then I have a problem. Further, when I tried to use a replace command such as


. replace hours = 89 if secnum == 1
(0 real changes made)

the problem is in how to convert these foolish "na" responses to value labels. I'm afraid I can't figure it out. I do recall several years ago a procedure to do this in the labeling functions, but I can't recall how to do it.
At the present the tab of this variable produces the following:


. tab hours

enter the |
number of |
hours |
written on |
the |
questionnai |
re in the |
space here. |
enter | Freq. Percent Cum.
------------+-----------------------------------
na | 1 25.00 25.00
na | 1 25.00 50.00
na | 1 25.00 75.00
na | 1 25.00 100.00
------------+-----------------------------------
Total | 4 100.00

What I want to do is drop the na and get the actual numbers behind them. The numeric values are there but they do not show on the labeling system.
Here is how I got to this stage:

I use a software package called Ci3, and it has prcedures for locating andn producing numeric values. In this case I used num etc etc to locate the measure when entered.

then I converted the output to spss version 11 save file. Then I used stat transfer to convert it from spss to a stata 8 file. The result is this.

If anyone might know how to solve the problem I would appreciate it.

jon ebeling
csu, chico






*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index