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

st: basic question on generating a string variable


From   J Bravo <jb34@duke.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: basic question on generating a string variable
Date   Wed, 9 Mar 2005 13:20:39 -0500 (EST)

dear all,

i have a data-set with unit- and year- string identifiers - respectively,
clave2str and year2str.

say that i want to create a new year-unit identifier, say clavestr, so
that the first two characters of clavestr give me the year (from year2str)
and the next 5 characters give me the unit (from clave2str)

     | clave2str   year2str |	clavestr
     |------------------|
100. |     1005       97 |	971005
101. |     1005       98 |	981005
102. |     1005       99 |	991005
103. |     1006       80 |	801006
104. |     1006       83 |	831006
     |------------------|
105. |     1006       86 |	861006
106. |     1006       89 |	891006


any advice?

thanks many.

jb

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index