BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
andrewfau
Fluorite | Level 6

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:

table.png

 

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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;

View solution in original post

4 REPLIES 4
Reeza
Super User

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;
andrewfau
Fluorite | Level 6
proc tabulate data=stats14f;
	class sale_yr dor_uc;
	var median_prc;
	table sale_yr, dor_uc*median_prc*(MEDIAN);
run;
Reeza
Super User

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.

 

Astounding
PROC Star

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 788 views
  • 0 likes
  • 3 in conversation