Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Integer values in Stata


From   Tim Evans <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: Integer values in Stata
Date   Thu, 1 Sep 2011 11:02:28 +0100

Dear all,

I have a list of values in a column in Stata like so:

end
.2
.4
.6
.8
1
1.2
1.4
1.6
1.8
2
2.2
2.4
2.6
2.8
3
3.2
3.4
3.6
3.8
4
4.2
4.4
4.6
4.8
5

and I wish to only keep the whole number value i.e. 1,2,3,4,5 etc. and drop any non integer values. I there use the following code 

keep if int(end)

however, I still end up with the following values 

end
1
1.2
1.4
1.6
1.8
2
2.2
2.4
2.6
2.8
3
3.2
3.4
3.6
3.8
4
4.2
4.4
4.6
4.8
5
How do I ensure I only keep the whole numbers? Using the following would not be ideal (keep if inlist(end, 1,2,3,4,5)) as I may have a much longer list.

Best wishes

Tim

_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index