How to count nonmissing number of observations

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 122
Accepted Solution

How to count nonmissing number of observations

Hi, I have a dataset. Two variables, year and return. What I want to do is for each year I want to count NON-missing observations of return and only keep if number is greater than 10. Now I use a proc sql command, and write something like

proc sql;

     create table a as

     select *

     from b

     group by year

     having count(*) >10

     order by year;

quit;

Will this work? My concern is that count option here will number of observations, no matter there is missing or no missing values in variable return.

Thanks.


Accepted Solutions
Solution
‎09-05-2013 02:03 AM
Super Contributor
Posts: 644

Re: How to count nonmissing number of observations

COUNT() and FREQ() are synonyms for N() in Proc SQL so your code should work.

Base SAS(R) 9.2 Procedures Guide

Richard

View solution in original post


All Replies
Super Contributor
Posts: 644

Re: How to count nonmissing number of observations

The N() function counts nonmissing values.


Richard

Solution
‎09-05-2013 02:03 AM
Super Contributor
Posts: 644

Re: How to count nonmissing number of observations

COUNT() and FREQ() are synonyms for N() in Proc SQL so your code should work.

Base SAS(R) 9.2 Procedures Guide

Richard

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 210 views
  • 0 likes
  • 2 in conversation