Help using Base SAS procedures

Assistance with transpose

Regular Contributor
Posts: 240

Assistance with transpose

HI I a have a question on a transpose

i have a table that looks like this

BRanch.  Name.    Date.   Compliance.

a1.           Apple.      08/25/14.     Reported

a2.            Apple.      08/25/14.   Reported

a3.             Mustard.    08/25/14.  Not reported

a3.            Mustard.      08/26/14.  Reported

the transpose table I would like it to look like

group Name

08/25/14.                                                                                                   08/26/14

branch.   Count.     total  Reported.  Not reported                .   Count.     total  Reported.  Not reported 

a1.             1.           1.       1

a2.             1.            1.      1

a3.              1.            1.                             1.                                  1.          1.          1

The count / total will change as there is more entries thank you again

Super User
Posts: 13,583

Re: Assistance with transpose

This looks more appropriate for a report than a dataset.

You show a "count" but what is it counting? It looks like you might be counting distinct levels of Name but you don't say that. Same with Totat, total of what?

Also example data should provide data that would give count/total values greater than one as many approaches that work for singleton types of data may not work when there are multiple values.

Regular Contributor
Posts: 240

Re: Assistance with transpose

HI Ballardw,

your right sorry my question was incomplete

What the table should look like is like this not reported and report is sum of occuerance ....


apple             2.                       39.                    22.                             7.

                   Uniq count   (Not reported)     Not report.      Reported   Unqui count (reported)

A1.                     1                  34.                       12.                          3

a2.                      1                 5.                        20.                           4

a3.                                          0.                         0.                           0

I hope that helps

Super User
Posts: 13,583

Re: Assistance with transpose

That's a more interesting result but the input data to go along with that is also needed.

Regular Contributor
Posts: 240

Re: Assistance with transpose

Hi Ballardw,

The data looks like this

ID.             COMPLIANCE.      Date.        Code

A1.                  yes                08/14/14.        A

A2.                   Yes.               08/15/14.        B

A1.                    No.                 08/15/14.       A

a2.                     No.                  08/14/14.      B

a1.                     Yes.                 08/16/14.       A


I Need the date to be column I need the compliance to be sum an breack out of yes an no... I need the count of ID ... Thanks for your assitance

Ask a Question
Discussion stats
  • 4 replies
  • 2 in conversation