Help using Base SAS procedures

need help with summarizing data

Reply
Contributor
Posts: 40

need help with summarizing data

Hi,

   I need help on how to summarize data by no of observations. For ex: I have data by customer segment and I want to see how many customers are there in each of segment (count), how can I do using proc summary.

thanks,

sasbase

Super User
Posts: 9,662

Re: need help with summarizing data

It is easy for proc summary.

proc summary data=have nway;

class segment;

output out=want n=how_many;

run;

Contributor
Posts: 40

Re: need help with summarizing data

What does n = how_many represent ? How can I get "how_many" ?

I used something like this :

PROC SUMMARY DATA=have missing NWAY;

CLASS var1 var 2 var 3 ;

ways 3 ;

OUTPUT OUT=want (DROP= _TYPE_)

         ;

RUN;

and then used _freq_ variable from above proc step to see as no of observations.

thanks,

sasbase

Trusted Advisor
Posts: 1,607

Re: need help with summarizing data

What does n = how_many represent ? How can I get "how_many" ?

N=HOW_MANY creates a data set variable named HOW_MANY in SAS data set WANT that contains N (the count of the number of observations in each group).

You access HOW_MANY the same way you access any data step variable.

Super User
Posts: 5,071

Re: need help with summarizing data

Is there some reason you have to use PROC SUMMARY to accomplish this?  PROC FREQ is built for this task:

proc freq data=have;

   tables segment / missing;

run;

Good luck.

Trusted Advisor
Posts: 1,607

Re: need help with summarizing data

Astounding wrote:

Is there some reason you have to use PROC SUMMARY to accomplish this?  PROC FREQ is built for this task:

I would claim that PROC SUMMARY is also built for this task (as well as other tasks)

Ask a Question
Discussion stats
  • 5 replies
  • 253 views
  • 0 likes
  • 4 in conversation