Rodrigo,
gen double id2=LOTE*1000000000+TIPO*100000000+FOLIO*1000+VIV*100+R101*1
should do the trick.
Hope this helps,
Eva
2009/3/6 Rodrigo Briceño <[email protected]>:
> Dear Statalisters. I'm using Stata 9 and I'm trying to generate a new
> variable that will be used as an identification for further merging of
> several databases.
> The id will be based on the conjunction of 5 variables called: LOTE,
> TIPO, FOLIO, VIV, R101.
> The larger and the lower values for each of these variables are shown below:
> 1400, 3, 17162, 9, 18 and 1, 0, 1, 0, 1
>
> From these values I build a formula, that applied in excel produced
> the desired results:
>
> gen id2=LOTE*1000000000+TIPO*100000000+FOLIO*1000+VIV*100+R101*1
>
> in excel the results produced were: 1,400,317,162,918 for the case
> with larger values and 1,000,001,001 for the case with lower values.
> The thing is that when I applied the formula in Stata the results are
> wrong. I thought that the error comes from the number of values shown
> in stata, but after changing to format id %14.0f the results are still
> wrong.
> What I got for the case of minimum values is the following: 1,000,001,024
>
> Does anybody knows what is possibly causing this mistake? Thanks for
> your kindly help.
>
>
> --
> Rodrigo Briceño
> Economist
> +506 22-91-12-00 ext. 113 Office
> +506 22-32-08-30 Fax
> +506 88-86-11-77 Cell
> [email protected]
> [email protected]
>
> MSN: [email protected]
> SKYPE: rbriceno1087
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/