BookmarkSubscribeRSS Feed
glee217
Calcite | Level 5

hi 

 

i'd like to create tabulate table to compare the difference between the median of total 'CURRENT_BALANCE' and median of total 'weekint' for genders

 

And i tried to create table using this code but don't know how to fix this code.

 

 

 

 

HERE is my code

proc tabulate data = mergediff;
class gender;
var CURRENT_BALANCE weekint;
table gender ALL, median*(CURRENT_BALANCE ALL);
run;

HERE is my error:

 

318 proc tabulate data = mergediff;
319 class gender;
320 var CURRENT_BALANCE weekint;
321 table gender ALL, median*(CURRENT_BALANCE ALL);
322 run;

ERROR: Statistic other than N was requested without analysis variable in the following nesting : gender * Median * All.
ERROR: Statistic other than N was requested without analysis variable in the following nesting : All * Median * All.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE TABULATE used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds

 

 I attached the result of data 'mergediff' by proc print for reference

 

캡처.JPG

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  I see that you have WEEKINT in your VAR statement, but you do NOT have it in your TABLE statement. So I do not believe you are going to get the comparison you want unless you do something with WEEKINT in the TABLE statement.

 

  This uses SASHELP.CLASS, but illustrates how you would compare median height with median weight:

** this generates error;
proc tabulate data = sashelp.class;
class sex;
var height weight;
table sex ALL, median*(height ALL);
run;
  
** This does not generate error;
** and compares median of height with median of weight;
proc tabulate data = sashelp.class;
class sex;
var height weight;
table sex ALL, 
      median*(height weight);
run;

 

cynthia

glee217
Calcite | Level 5
yes it's because i didn't know how to form a code?
can you tell me what i have to do? i still want to compare two medians

Astounding
Opal | Level 21

It sounds like you need a small adjustment to the TABLES statement.  Where you now have this:

 

(CURRENT_BALANCE ALL)

 

try this instead:

 

(CURRENT_BALANCE WEEKINT)

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 898 views
  • 1 like
  • 3 in conversation