<>
*************
clear*
input str10 var
"2011017:1"
"2011018:1"
"2011018:2"
"2011026:1"
"2011040:1"
"2011041:1"
end
compress
list, noobs
gen newvar= substr(var,-1,.)
destring newvar, gen(mynewvar)
cou if mynewvar==2
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Tunga Kantarci
Gesendet: Dienstag, 19. Mai 2009 23:37
An: [email protected]
Betreff: st: data entries
Hello,
I have a string variable whose entries look like as below:
2011017:1
2011018:1
2011018:2
2011026:1
2011040:1
2011041:1
I need to determine how many of these entries have "2" at the end (i.e. as
you see above some entries have ":1" and some others have ":2". I would
like to determine the number of entries with ":2" at the end.
What would be the command for this?
*
* 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/
*
* 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/