I just wrote some code for this for someone else, so it's fresh on the
brain.
/* assumes nacimi is numeric and of fixed length */
gen nacimi-1 = real(substr(string(nacimi),1,4))
gen nacimi-2 = real(substr(string(nacimi),-4,4))
-dan
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of jtuesta
Sent: Monday, December 08, 2003 4:03 PM
To: [email protected]
Subject: st: The last four digits
Dear Statalisters,
I have a numerical variable in my data, its name is �nacimi�
I would like to separate the last four digits for to have two variables. For
example:
I have
nacimi
01041974
01051973
07041975
08061972
I�d like:
nacimi-1 nacimi-2
0104 1974
0105 1973
0704 1975
0806 1972
Thanks in advance!
--
Open WebMail Project (http://openwebmail.org)
*
* 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/
*
* 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/