Proc Means/Summary/Tabulate/????

Solved
Frequent Contributor
Posts: 76

Proc Means/Summary/Tabulate/????

Dear All,

I'm pretty new to SAS and i'm having a confusion with one of my query. I have a data structure as mentioned below and need summarised output and i'm simply confused with which proc function this can be done and how.

I have below this table

Name - Prod

A1 - CC

A2 - CC

A3 - LN

A1 - CC

A3-ST

A1-CC

A2-LN

A3-CC

A1-LN

A1-CC

My output should be

Name   CC    LN     ST

A1        4        1      0

A2        1        1      0

A3        1        1      1

Pls anyone can help me with code...

Thanks  a lot...

Rgds, Anil

Accepted Solutions
Solution
‎02-13-2013 03:47 PM
Super User
Posts: 11,810

Re: Proc Means/Summary/Tabulate/????

Either Proc freq or tabulate would do. The syntax for freq is probably simpler:

proc freq data=yourdatasetname;

tables name*prod/ norow nocol nocum nopercent;

run;

All Replies
Solution
‎02-13-2013 03:47 PM
Super User
Posts: 11,810

Re: Proc Means/Summary/Tabulate/????

Either Proc freq or tabulate would do. The syntax for freq is probably simpler:

proc freq data=yourdatasetname;

tables name*prod/ norow nocol nocum nopercent;

run;

Frequent Contributor
Posts: 76

Re: Proc Means/Summary/Tabulate/????

Shaks.. that's it.. just a single line of code and its done.. and i was breaking my head last 3 hours trying so many variations... Thanks a lot Ballard.. Now just one more small query in addition to it..

I also have one more column for LN & ST which mentions amount and i want to sum them for each name....

Thanks once again...

Rgds, Anil

SAS Super FREQ
Posts: 3,839

Re: Proc Means/Summary/Tabulate/????

Sounds like you want to include a WEIGHT statement:
proc freq ....;

WEIGHT amount;
tables ....;

run;

🔒 This topic is solved and locked.

Discussion stats
• 3 replies
• 192 views
• 0 likes
• 3 in conversation