DATA Step, Macro, Functions and more

Median in sas 9.3

Accepted Solution Solved
Reply
Contributor
Posts: 72
Accepted Solution

Median in sas 9.3

[ Edited ]

Dear all,

 

I have created a ODS excel report with proc report, I have noticed in one of the excel outputs that one table should be reflecting the Median values instead of sum.. I tried changing this in the proc report statement:

define Numbers/group median style={tagattr='format:#,###'} center;  /** changed sum to median**/ but it doesnt work.

 

I tried changing in the base data set in sas using proc sql query, still no use.

 

Request you to kindly suggest any syntax or anything.I am using SAS 9.3 currently..

 

Many thanks.

 

 


Accepted Solutions
Solution
‎02-13-2018 11:38 PM
Contributor
Posts: 72

Re: Media in sas 9.3

I have ungrouped my sas dataset and used it again for median under ODS proc reports, and it is working now. Smiley Happy

View solution in original post


All Replies
Super User
Super User
Posts: 9,193

Re: Media in sas 9.3

Its generally not a good idea to do processing in proc report, as that is a reporting function.  Use proc means before that to get the data in the way you want then a simple proc report to output the data.  Don't think report can even do the more complicated calculations.

proc means data=yourdata;
  by id;
  var thevar;
  output out=want median=median;
run;

Shows and example use of proc means (as you haven't shown any test data or code this is just an example).

Super User
Posts: 9,548

Re: Media in sas 9.3

You can use statistics only on analysis variables. See the documentation for this:

 

statistic

associates a statistic with an analysis variable. You must associate a statistic with every analysis variable in its definition. PROC REPORT uses the statistic that you specify to calculate values for the analysis variable for the observations that are represented by each cell of the report. You cannot use statistic in the definition of any other type of variable.

 

(emphasize by me)

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 22,818

Re: Media in sas 9.3

ODS EXCEL isn't supported in SAS 9.3

 

Are you using ODS TAGSETS.EXCELXP or something else?


don21 wrote:

Dear all,

 

I have created a ODS excel report with proc report, I have noticed in one of the excel outputs that one table should be reflecting the Median values instead of sum.. I tried changing this in the proc report statement:

define Numbers/group median style={tagattr='format:#,###'} center;  /** changed sum to median**/ but it doesnt work.

 

I tried changing in the base data set in sas using proc sql query, still no use.

 

Request you to kindly suggest any syntax or anything.I am using SAS 9.3 currently..

 

Many thanks.

 

 


 

Solution
‎02-13-2018 11:38 PM
Contributor
Posts: 72

Re: Media in sas 9.3

I have ungrouped my sas dataset and used it again for median under ODS proc reports, and it is working now. Smiley Happy
☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 158 views
  • 0 likes
  • 4 in conversation