Help using Base SAS procedures

Proc Report summary statisistics

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

Proc Report summary statisistics

[ Edited ]

I am trying to create a report using proc report where in I have grouped by a variable named probability and inside the groupped variable is another variable Account_name which is a character variable. I want to the frequency of this variable for each group of probability 

eg-

probability Accounts

1                 3

0.9              4

0.8             6

and so on, but i am not able to do that because it displays all the account_Names inside each probability rather than the freuency/count of the column

what i am getting is

probability  accounts

1                LG

                  max

                  LF

0.9            GH

                 PL

and so on

following is the code I used-

proc report data= c1.o;
columns probability____  Account_Name Total_Media_Value Forecasted_Budget;
define probability____ / group order descending 'Probability';
define Account_Name/ n 'Accounts';
define Total_Media_Value /sum 'Total_Budget';
define Forecasted_Budget/ computed 'Forecasted Budget';
compute Forecasted_Budget;
Forecasted_Budget= (Total_Media_Value.sum)*(probability____);
endcomp;

run;

in the define Account_Name line i have used display and analysis as well but no use 

i get the error

ERROR: Account_Name is an ANALYSIS variable but not numeric.

 


Accepted Solutions
Solution
‎12-28-2017 09:32 AM
Respected Advisor
Posts: 3,054

Re: Proc Report summary statisistics

PROC SUMMARY will give you frequencies in a dataset, it can sum the Total_Media_Value, and so on. If you need to compute percentages from those frequencies this is also done easily in a SAS data step. I find it much easier to do manipulations in a SAS data step than getting the math correct in PROC REPORT.

--
Paige Miller

View solution in original post


All Replies
Super User
Super User
Posts: 9,599

Re: Proc Report summary statisistics

Do a proc freq or means before getting to the proc report.  Report is a reporting procedure, not a freq/means procedure (even though it can do some basic stuff).  

Contributor
Posts: 23

Re: Proc Report summary statisistics

[ Edited ]

Is the issue that the column is of character format?Because for numerical columns it can calculate a lot of statistics even percentiles.And how do i combine the freq table with the report table? 

Respected Advisor
Posts: 3,054

Re: Proc Report summary statisistics


RW9 wrote:

Do a proc freq or means before getting to the proc report.  Report is a reporting procedure, not a freq/means procedure (even though it can do some basic stuff).  


I agree with this. Getting the data computed properly before you run PROC REPORT will make your life sooooooo much simpler.

--
Paige Miller
Contributor
Posts: 23

Re: Proc Report summary statisistics

Posted in reply to PaigeMiller

issue is proc freq wont work if done before. How do you suggest that would solve the problem?

Solution
‎12-28-2017 09:32 AM
Respected Advisor
Posts: 3,054

Re: Proc Report summary statisistics

PROC SUMMARY will give you frequencies in a dataset, it can sum the Total_Media_Value, and so on. If you need to compute percentages from those frequencies this is also done easily in a SAS data step. I find it much easier to do manipulations in a SAS data step than getting the math correct in PROC REPORT.

--
Paige Miller
Super User
Posts: 23,771

Re: Proc Report summary statisistics

PROC TABULATE may be what you're looking for. 

☑ This topic is solved.

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

Discussion stats
  • 6 replies
  • 272 views
  • 0 likes
  • 4 in conversation