Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: RE: generating a new numerical variable3 using a string variable2 which is nested in a numerical variable1


From   José Maria <[email protected]>
To   <[email protected]>
Subject   st: Re: RE: generating a new numerical variable3 using a string variable2 which is nested in a numerical variable1
Date   Sat, 14 Nov 2009 20:53:46 -0200

dears Martin, Kit:
thank you.
Both ways made it!
José Maria
Jose Maria Pacheco de Souza, Professor Titular (aposentado)
Departamento de Epidemiologia/Faculdade de Saude Publica, USP
Av. Dr. Arnaldo, 715
01246-904  -  S. Paulo/SP - Brasil
fones (11)3061-7747; (11)3768-8612;(11)3714-2403
www.fsp.usp.br/~jmpsouza
----- Original Message ----- From: "Martin Weiss" <[email protected]>
To: <[email protected]>
Sent: Saturday, November 14, 2009 4:10 PM
Subject: st: RE: generating a new numerical variable3 using a string variable2 which is nested in a numerical variable1



<>

Jose could also use:


*******
clear*

inp byte var1 str1 var2
1  a
1  a
1  a
1  b
2  m
2  m
2  n
2  n
2  p
3  c
3  c
3  c
3  c
end

compress

contract var1 var2
bys var1: gen byte num=_n
expand _freq
sort var1 var2
drop _freq
li, noo sepby(var1)
*******


HTH
Martin



__________ Informação do ESET NOD32 Antivirus, versão da vacina 4607 (20091114) __________

A mensagem foi verificada pelo  ESET NOD32 Antivirus.

http://www.eset.com



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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index