Hi,
I am a newbie to stata but here is my valiant attempt!!!
This is doing it one command at a time .. I guess you can do a loop .. I am
not much of an expert ..sorry!!!!!!!!!
destring Grp1 Grp2 Grp3 Grp4, generate(a b c d) ignore(";",",")
tostring a b c d, replace
gen var1=length(a)
gen var2=length(b)
gen var3=length(c)
gen var4=length(d)
drop Grp1 Grp2 Grp3 Grp4
regards
rajesh
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Alexander Nervedi
Sent: 08 February 2006 01:04
To: [email protected]
Subject: st: strings hnadling
Hi List users,
I have data which has been entered awkwardly.
Instead of taking each a seperate variable for each item - all items of a
category are entered together in a variable.
ID Grp1 Grp2 Grp3 Grp4
001 2;3;4 10;99;2 01 11,2,25,2,3
I'd like to convert this to a dataset that looks like
ID Grp1 Grp2 Grp3 Grp4
001 3 3 1 5
i.e. the count of the number of semi-colons within each variable. I am sure
there is a neat way of doing this but I am missing it. So i thought i'd
write in and ask for u r help.
thanks
Alnerdy
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
*
* 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/