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

Re: st: basic question on generating a string variable


From   Doug Owens <[email protected]>
To   [email protected]
Subject   Re: st: basic question on generating a string variable
Date   Wed, 09 Mar 2005 15:12:25 -0500

g newid = year2str + clave2str

or if clave2str is not always of length 4 and you want to pad it to be length 4,

g newid = year2str +substr("0000",1,4-length(clave2str)) + clave2str




Doug Owens


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