Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: help with displaying appropriately formatted regression coefficients and p-values


From   Miranda Kim <mk@mrc.soton.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: help with displaying appropriately formatted regression coefficients and p-values
Date   Thu, 01 Oct 2009 10:33:10 +0100

I am trying to write a loop to format my regression coefficients and 
p-values so that I have 2 significant figures for my p-values and a 
reasonable format for the betas (these span considerably different 
scales...). I want to do it in a loop as I have hundreds of these 
coefficients and p-values.
I was thinking of some loop as follows, but foreach doesn't seem 
appropriate here...
Any clues would be of great help!

foreach num of numlist 1.367456 0.0000925 0.5623 13.5678 {
    if `num' < 0 {    /* store number in macro as string rounded to two 
significant figures */
    }
    if `num' > 1 {    /* store number in macro as string rounded to two 
decimal places */
    }
}

I use Stata 10 btw.
Many thanks!


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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