DATA Step, Macro, Functions and more

Count and Transpose

Reply
Super Contributor
Posts: 673

Count and Transpose


there are five columns
id source target value flag. and flag has the following values.each value can be present more than 1 time for each id

    flag
    first
    gen16
    last
    all


how to transpose this flag field as columns first gen16 last all and then under each of these columns give their count for the respective id       

Super User
Posts: 11,343

Re: Count and Transpose

If you don't need a new dataset

proc tabulate data=have;

     class id;

     class flag;

     table id, flag *n;

run;

might work.

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