On my thank-you post I forgot to include a thread
excerpt, as is expected. Apologies.
Cheers,
Ainsley
----------------------------------------------------
German gave:
<snip>
gen zpid = substr("00"+ref,-2,2) +
substr("00000"+ed,-5,5)
Joseph gave:
<snip>
generate str unique_identifier = ///
string(region_number, "%2.0f") + "-" + ///
string(enumeration_district_number, "%05.0f")
And Maarten: <snip> tostring x, format(%05.0f) replace
All in response to:
<snip>
Reg is consistently a str2 but ed is not (at most,
though, it's a str5). I wish my new variable to be a
str7 of the form "1000100", "1103200", and "1216400"
for the examples provided. So, for ed, I need to add
two leading zeros to the first observation and one to
the second. Then I need to create the new variable.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.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/