[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

# st: Hello all

 From Jon Ebeling To statalist@hsphsun2.harvard.edu Subject st: Hello all Date Sat, 18 Sep 2004 08:16:21 -0700

I have a problem in trying to convert an alpha character to real. I have converted the data from spss to stata using stat transfer, but one of the numeric variables has na positioned for all of the "na" measures. I can see the actual values since when I run sum by a grouping command they appear. I'm a bit rusty in stata now, and I do recall that I could use the function real to convert the alpha characteris to their actual numeric values. I cannot seem to get the real command to work.

Perhaps if there is someone out there who might recall this procedure, I would be appreciative.

Here is what happens:

. 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

when I try to convert these to real numbers it does this:

. real("hours")
unrecognized command: real
r(199);

I have been unable to find the real command in the handbooks, so I thought I might ask more skilled persons here.

The actual numbers are these:

. 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

If anyone can show me what mistakes I'm making I will be in your debt.

Thanks

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