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

st: RE: storage type problem


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: storage type problem
Date   Fri, 28 Feb 2003 16:00:04 -0000

Kostova Deliana (HXX1DAK)
> 
> I ran into the following small problem that, I think, has 
> to do with storage
> types, but I'm not sure how to solve it...
> 
> Suppose we want to calculate the product of -.1796042 and 
> 4.752947, so we
> type:
> display -.1796042^4.752947
> and we get
> -.00028563
> 
> However, if we have variable X= -.1796042 and variable 
> Y=4.752947, and we
> type
> gen Z=X*Y, Stata will generate Z=. even though Z should be 
> -.00028563.  
> 
> I know this has to do with storage types, so i tried
> gen double Z=X*Y, but this still produces a missing variable...

What do you want, power ^ or product * ?

I get with StataSE 8 

. di -.1796042^4.752947
-.00028563

. di -.1796042*4.752947
-.85364924

. clear

. set obs 1 
obs was 0, now 1

. gen power =  -.1796042^4.752947

. gen product =  -.1796042*4.752947

. l

     +-----------------------+
     |     power     product |
     |-----------------------|
  1. | -.0002856   -.8536493 |
     +-----------------------+

Nick 
[email protected] 
*
*   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