Statalist The Stata Listserver


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

Re: st: three tiny queations


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: three tiny queations
Date   Thu, 22 Feb 2007 21:15:37 +0100

Xiaoheng Zhang asked three questions:
 
1.Could I speicfy a precision level to certain digit for
the outcome? Say 4-digit after decimal point?
 
The answer depends on the command. 
 
You can specify a fixed format for a variable, e.g.
  format var1 %7.4f
This has effect for -list-, for labels on graph axes,
for -ci- and -tabulate, summarize()-, but not for most
other commands. (I think this is fine for -list- and graph
axes, but quite bad for -ci- and -tabulate, summarize()-).
 
For some commands, e.g. -table- and -tabstat- you may specify
the output format by command options, e.g.
   table ... , format(%7.4f)
 
For most commands, I believe, you cannot really control the
precision level displayed.
------------------------------------------------------------
 
2.Could STATA display 0 before decimal point for the outcome?
 
Command dependent as above:
  format var1 %06.4f
  table ... , format(%06.4f)
------------------------------------------------------------
 
3.How to use "if" for the string variables. For example, I have
a variable "nationality" having two values-EU or US. How can I
construct a condition started with if,like "if nationality==EU"?
 
  ... if nationality=="EU"
------------------------------------------------------------
 
Hope this helps
Svend 
 
________________________________________________________ 
 
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:  +45 8942 6090 
Phone, home:  +45 8693 7796 
Fax:          +45 8613 1580 
E-mail:       [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