Statalist The Stata Listserver


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

RE: st: Re: coding


From   Maarten buis <[email protected]>
To   [email protected]
Subject   RE: st: Re: coding
Date   Sat, 28 Jan 2006 12:11:11 +0000 (GMT)

Alexander Nervedi wrote:
> All i need to do is figure out how to get the formatting to
> show leading zeros!

Maarten Buis wrote:
> *-------begin example------
> sysuse auto, clear
> list price in 1/10
> format price %06.0f
> list price in 1/10
> *-------end example---------

also see: http://www.stata.com/support/faqs/data/leading0.html This also discusses puting your
variable as a string. This might be convenient if you want to say "if the third character equals
whatever do something smart".

Michael Blasnik wrote:
> If you had more years than you might need to create the score
> variable as a double. 
As long as you have 9 years or less you could probably better use the long dataformat. This will
ensure that your variabel realy is an interger. 

so use -gen long score=possibility*10^(year-1)- instead of -gen score=possibility*10^(year-1)-

HTH,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


		
___________________________________________________________ 
NEW Yahoo! Cars - sell your car and browse thousands of new and used cars online! http://uk.cars.yahoo.com/
*
*   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