BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aj34321
Quartz | Level 8

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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;

View solution in original post

3 REPLIES 3
ballardw
Super User

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;

aj34321
Quartz | Level 8

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

Rick_SAS
SAS Super FREQ

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

WEIGHT amount;
tables ....;

run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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