DATA Step, Macro, Functions and more

deleting obs with conditions

Accepted Solution Solved
Reply
Contributor
Posts: 51
Accepted Solution

deleting obs with conditions

Hi,

 

My data looks like follows,

 

PERMNOT1T2upto T516
1   
2   
3   

 

Now, I want to delete permno's if all observations from T1 through T516 are missing.

And then I also want to delete permno's which have less than 24 observations from T1 through T516 (as there are missing values in my data set)

 

Can someone suggest on how to do this?

 

Thanks.


Accepted Solutions
Solution
3 weeks ago
Trusted Advisor
Posts: 1,312

Re: deleting obs with conditions

data want;
   set have;
   array t {*} t1-t516;
   if n (of t{*}) > 24;
run;

View solution in original post


All Replies
Solution
3 weeks ago
Trusted Advisor
Posts: 1,312

Re: deleting obs with conditions

data want;
   set have;
   array t {*} t1-t516;
   if n (of t{*}) > 24;
run;
☑ This topic is solved.

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

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