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?
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;
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;
proc tabulate data=stats14f;
class sale_yr dor_uc;
var median_prc;
table sale_yr, dor_uc*median_prc*(MEDIAN);
run;
I misunderstood your question, my answer above is not correct.
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.
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.