BookmarkSubscribeRSS Feed
Sanjay_M
Obsidian | Level 7

Please help me with a PROC SUMMARY (only) statement to get the volume by category, weighted volume by category, mean of score by category.

 

Reason I want to use PROC SUMMARY is because I have other code using the same and PROC SUMMARY produces other metrics.

 

data test;

length category score wt 8;

input category score wt;

infile datalines dlm=",";

datalines;

 

1,67,2

1,50,5

1,55,6

2,56,6

2,68,5

3,70,5

4,73,8

run;

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

A couple of questions:

  • which variable is "volume"?
  • when you say you want to get the volume by category, is this a sum or a mean or something else?
  • when you want weighted volume, what variable does the weighting (and do you want the sum or the mean or something else)?
--
Paige Miller
Sanjay_M
Obsidian | Level 7

 

  • which variable is "volume"? Category is segment, so I want volume and weighted volume by category
  •  
  • when you say you want to get the volume by category, is this a sum or a mean or something else? Count by category
  •  
  • when you want weighted volume, what variable does the weighting (and do you want the sum or the mean or something else)? Column is weight

 

 

Sanjay_M
Obsidian | Level 7

Can the admin please move this post to the Statistical group

PaigeMiller
Diamond | Level 26
proc summary data=have;
    class category;
    var wt score;
    output out=stats mean(score)=score_mean sum(wt)=wt_volume;
run;
     

The variable _FREQ_ is the unweighted volume.

   

--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 524 views
  • 0 likes
  • 2 in conversation