Statalist


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

st: AW: Dropping observations


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Dropping observations
Date   Thu, 17 Sep 2009 15:57:16 +0200

<> 

I assume those values are stored as -string-s? If not, turn them into
strings with the -string()- function, and then:


*************
clear*

inp str10 myvar
0011 
8944 
4500 
3512
0989
end

compress

//for two
drop if substr(myvar,1,2)=="00"
list, noobs

//for one digit
drop if substr(myvar,1,1)=="0"
list, noobs
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Ermias Ogbai
Weldemicael
Gesendet: Donnerstag, 17. September 2009 14:48
An: [email protected]
Betreff: st: Dropping observations

Dear Stata users,

I am trying to drop observation from one variable. The variable contains
four digit values (e.g. 0011 8944 4500 3512..). Is it possible to drop an
observation by if condition of the first digit..or first two digits. Like
'drop if value starts with 00'

Thanks,

Ermias O. Weldemicael
PhD student
University of Melbourne



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



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