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: How do I drop fist and last observations please?
From
Lance Erickson <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: How do I drop fist and last observations please?
Date
Mon, 18 Jul 2011 12:58:54 -0600
I believe the following should work...
drop if inlist(_n,1,_N-1)
Lance
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Lucie Vlach
Sent: Monday, July 18, 2011 12:38 PM
To: [email protected]
Subject: st: How do I drop fist and last observations please?
Hello everyone!
I need to drop my first and last observation from a data set in a do file.
Not all datasets will have the same number of observations. Is there a good 'drop' command that will do this for me, regardless how long my dataset is? It will always be the first and last observation.
Here is the example of my data:
Record_Type Sub_Prefix Current_Yr Source Sequence_Number Check_Digit Transaction_Type Segment_Type Segment_Sequence Action_Code Unused Claim_Type Service_Provider_ULI Skill_Code Service_Recipient_ULI
2 UCM 00 00 80
3 UCM 11 00 00546733 4 CIP1 CIB1 0001C RGLR 3535446208 PSYC 352543330
3 UCM 11 00 0037920 6 CIP1 CIB1 0001A RGLR 2296454208 GP 445454551
4 UCM 00 00 8000143 0 0000 144
Here I want to drop: "2 UCM 00 00 80" and "4 UCM 00 00 8000143 0 0000 144"
Thank you all very much for any help!
Lucie
This message and any attached documents are only for the use of the intended recipient(s), are confidential and may contain privileged information. Any unauthorized review, use, retransmission, or other disclosure is strictly prohibited. If you have received this message in error, please notify the sender immediately, and then delete the original message. Thank you.
*
* 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/