DATA Step, Macro, Functions and more

deleting obs with conditions

Accepted Solution Solved
Reply
Contributor
Posts: 69
Accepted Solution

deleting obs with conditions

Hi,

 

If my data looks like follows, how do I drop permnos  where (A200801--A200805) contains less than say 4 observations?

 

permnoA200801A200802A200803A200804A200805B200801B200802B200803B200804B200805
1          
2          
3          

Accepted Solutions
Solution
‎04-28-2018 04:28 PM
Esteemed Advisor
Posts: 5,614

Re: deleting obs with conditions

If those variables are numeric and you want to delete observations with less than 4 non missing values, then:

 

if n(of A200801 -- A200805) < 4 then delete;

PG

View solution in original post


All Replies
Solution
‎04-28-2018 04:28 PM
Esteemed Advisor
Posts: 5,614

Re: deleting obs with conditions

If those variables are numeric and you want to delete observations with less than 4 non missing values, then:

 

if n(of A200801 -- A200805) < 4 then delete;

PG
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 146 views
  • 0 likes
  • 2 in conversation