Solved
Contributor
Posts: 32

# Making a Table

I am trying to make a table with Sale Years on the left side, and Use Codes along the top. Here is my program I am running:

``````proc tabulate data=stats14f;
class sale_yr dor_uc;
var median_prc;
table sale_yr, dor_uc;
run;``````

And this is what I end up with:

How do I get the table to show my median_prc data instead of just N? Should I even be running the proc tabulate statement or is there something else?

Accepted Solutions
Solution
‎08-30-2017 03:40 PM
Super User
Posts: 23,683

## Re: Making a Table

N is the default statistic. For a median add the keyword MEDIAN after the variable, ie Yearly median for the stock price.

``````proc tabulate data=sashelp.stocks;
class date stock ;
var open;
format date year4.;
table stock, date*open*(median);
run;``````

All Replies
Solution
‎08-30-2017 03:40 PM
Super User
Posts: 23,683

## Re: Making a Table

N is the default statistic. For a median add the keyword MEDIAN after the variable, ie Yearly median for the stock price.

``````proc tabulate data=sashelp.stocks;
class date stock ;
var open;
format date year4.;
table stock, date*open*(median);
run;``````
Contributor
Posts: 32

## Re: Making a Table

``````proc tabulate data=stats14f;
class sale_yr dor_uc;
var median_prc;
table sale_yr, dor_uc*median_prc*(MEDIAN);
run;``````
Super User
Posts: 23,683

## Re: Making a Table

It's showing the median of the variable median price. If you have data and want to display it, not calculate summary statistics then PROC TABULATE is not the correct procedure.

You should be using PROC REPORT, and include the variable for the columns as an ACROSS type in the DEFINE statement.

Super User
Posts: 6,754

## Re: Making a Table

The VAR statement allows you to use MEDIAN_PRC in your table. However, it's still up to you whether you want to use it or not.

Is MEDIAN_PRC actually the name of one of your variables?  Does your data already contain a single observation for each combination of SALE_YR and DOR_UC?  If so, you could code:

table sale_yr, dor_uc * median_prc * mean=' ';

But if MEDIAN_PRC is not one of your existing variables, you'll have to explain what variables are in your data set.

☑ This topic is solved.