Statalist


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

st: local=0802 vs. local=802


From   Man Jia <[email protected]>
To   [email protected]
Subject   st: local=0802 vs. local=802
Date   Mon, 16 Jun 2008 12:19:52 -0400 (EDT)

Hi all,

I was wondering how to successfully defining local macros beginning 
with 0, since I think probably STATA automatically ignores the 0 in the 
beginning of a local's expression.

my data set has following variables:
-----------
T0990802
T0991302
T0991802
T0992302
T0992802
T0993302
T0993802
T0994302
------------
I want to create new variables equal the value of 2006 subtracted by 
T0990802, T0991302,... and T0994302.
I tried the following command:
------------------------------------------
local j=0802
forvalue i =1/8 {
g age`i'=2006-T099`j'
replace age`i'=2006-T099`j'
local j=`j'+500
}
end
-----------------------------------------
But STATA gives the error information :
" T099802 not found
  r(111); "

I guess it's probably because STATA treats "local j=0802" as "local j 
=802". How could I make the 0 in 0802 not ignored?

Thanks for your time!

Man Jia

*
*   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