DATA Step, Macro, Functions and more

counts

Reply
Super Contributor
Posts: 673

counts

ssn  pin    id
s1   p1     c1a
s1   p2     c1b
s1             c1c


s2               c2
s2              c2a

s3              c3
s3             c3a

s4              c4a
s4  p4       c4b


count where pin is missing with pin present for other records : 2 (ssn s1 and s4)

count where pin is not present all : 2 (s2 and s3 )

PROC Star
Posts: 7,474

Re: counts

proc sql;

  select sum(all_miss) as all_miss,

         sum(miss_count) as miss_count

    from

  (select count(pin) eq 0 as all_miss,

   count(pin) gt 0 as miss_count

    from have

      group by ssn

        having nmiss(pin) gt 0)

  ;

quit;

Ask a Question
Discussion stats
  • 1 reply
  • 149 views
  • 0 likes
  • 2 in conversation