Help using Base SAS procedures

Assistance with Proc Summary

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

Assistance with Proc Summary

Hi there. Im struggling a little bit with a proc summary. I have a large data set that holds 3 variables: an IDNumber(Char) a date (date format) and a value (200.00) the whole period covers March to August I'm trying to summarise it so it outputs an average value per IDNumber for each month. I'd like the table in the following way:- Ive attached a sample table of how im trying to make the sample look

Accepted Solutions
Solution
‎10-08-2017 10:31 AM
Respected Advisor
Posts: 3,055

Re: Assistance with Proc Summary

[ Edited ]

PROC SUMMARY should be able to do this as well. 

 

Something like

 

proc summary data=have nway;
    class IDNumber Date;
    format date monyy.;
    var value;
    output out=want mean=meanvalue;
run;
      

 

--
Paige Miller

View solution in original post


All Replies
Super Contributor
Posts: 391

Re: Assistance with Proc Summary

if yo like a report you can use the tabulate procedure followed by a transpose:

proc tabulate data=one out=two;

class idnumber month;

table idnumber, month*value*mean;

var value;

run;

 

proc transpose data=two out=three;

by idnumber;

id month;

var value_Mean;

run;

 

//Fredrik

Contributor
Posts: 66

Re: Assistance with Proc Summary

Hi.

 

Thank you for the response this is working perfectly thank you, clearly I was failing as I was using the wrong procedure !!

 

Last question if I may, if I wanted the same table but summed instead of mean would it be this

 

proc tabulate data=ZFinal out=Output;
class FDAccountNumber Month;
table FDAccountNumber, Month*Amount;
var Amount;
run;

 

 

Solution
‎10-08-2017 10:31 AM
Respected Advisor
Posts: 3,055

Re: Assistance with Proc Summary

[ Edited ]

PROC SUMMARY should be able to do this as well. 

 

Something like

 

proc summary data=have nway;
    class IDNumber Date;
    format date monyy.;
    var value;
    output out=want mean=meanvalue;
run;
      

 

--
Paige Miller
☑ This topic is solved.

Need further help from the community? Please ask a new question.

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