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

Hi all,

 

I'm hoping to get descriptive statistics (n mean stddev min max median 95% CLM) on the sample data below. So, VISIT on the vertical pane going down and TIB_GROUP across on the top.

 

Visit Patient TIB_GROUP SCORE
1 1 1 85.29
2 1 1 61.76
3 4 1 59.35
1 2 0 44.12
2 2 0 58.82
1 3 2 80.88
2 3 2 86.76
1 4 1 42.89
2 4 1 23.53
3 4 1 69.12
1 5 0 79.41
2 5 0 66.18
3 5 0 92.65
1 6 0 69.12
2 6 0 76.47
1 7 2 97.06
2 7 2 97.06
1 8 1 72.06
2 8 1 73.53

How can I use proc means or proc tabulate for this? I'm having trouble getting all the descriptive stats I need

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

This should work:

proc tabulate data=have;
  class visit tib_group;
  var score;
  table visit,
        tib_group*score*(n mean stddev min max median lCLM uclm)
  ;
run;

Tabulate and Means both calculate the lower and upper confidence limits requested not an "interval". There are a number of tricks that can make something appear like an interval if that is a serious issue.

You may want to suppress the appearance of the variable Score or its default label, if any, by using

Score=' '*(<statistics list here>)

 

If this doesn't match you requirement then I suggest manually building an example such as using a word processor or similar and showing what you expect.

 


@Etoo12121 wrote:

Hi all,

 

I'm hoping to get descriptive statistics (n mean stddev min max median 95% CLM) on the sample data below. So, VISIT on the vertical pane going down and TIB_GROUP across on the top.

 

Visit Patient TIB_GROUP SCORE
1 1 1 85.29
2 1 1 61.76
3 4 1 59.35
1 2 0 44.12
2 2 0 58.82
1 3 2 80.88
2 3 2 86.76
1 4 1 42.89
2 4 1 23.53
3 4 1 69.12
1 5 0 79.41
2 5 0 66.18
3 5 0 92.65
1 6 0 69.12
2 6 0 76.47
1 7 2 97.06
2 7 2 97.06
1 8 1 72.06
2 8 1 73.53

How can I use proc means or proc tabulate for this? I'm having trouble getting all the descriptive stats I need


 

View solution in original post

4 REPLIES 4
Reeza
Super User

How do you want the stats displayed? As columns or row headers?

Can you show an example?

 

Does either one of these get you closer to what you want:

title 'Version 1';
proc tabulate data=have;
class visit tib_group;
var score;
table visit, tib_group * score*(N Mean MIN MAX MEDIAN);
run;

title 'Version 2';
proc tabulate data=have;
class visit tib_group;
var score;
table visit * score*(N Mean MIN MAX MEDIAN), tib_group ;
run;

@Etoo12121 wrote:

Hi all,

 

I'm hoping to get descriptive statistics (n mean stddev min max median 95% CLM) on the sample data below. So, VISIT on the vertical pane going down and TIB_GROUP across on the top.

 

Visit Patient TIB_GROUP SCORE
1 1 1 85.29
2 1 1 61.76
3 4 1 59.35
1 2 0 44.12
2 2 0 58.82
1 3 2 80.88
2 3 2 86.76
1 4 1 42.89
2 4 1 23.53
3 4 1 69.12
1 5 0 79.41
2 5 0 66.18
3 5 0 92.65
1 6 0 69.12
2 6 0 76.47
1 7 2 97.06
2 7 2 97.06
1 8 1 72.06
2 8 1 73.53

How can I use proc means or proc tabulate for this? I'm having trouble getting all the descriptive stats I need


 

Etoo12121
Obsidian | Level 7
Version 2 is perfect but how can I add the 95% Confidence Interval and standard deviation? That's what I've been struggling with
ballardw
Super User

This should work:

proc tabulate data=have;
  class visit tib_group;
  var score;
  table visit,
        tib_group*score*(n mean stddev min max median lCLM uclm)
  ;
run;

Tabulate and Means both calculate the lower and upper confidence limits requested not an "interval". There are a number of tricks that can make something appear like an interval if that is a serious issue.

You may want to suppress the appearance of the variable Score or its default label, if any, by using

Score=' '*(<statistics list here>)

 

If this doesn't match you requirement then I suggest manually building an example such as using a word processor or similar and showing what you expect.

 


@Etoo12121 wrote:

Hi all,

 

I'm hoping to get descriptive statistics (n mean stddev min max median 95% CLM) on the sample data below. So, VISIT on the vertical pane going down and TIB_GROUP across on the top.

 

Visit Patient TIB_GROUP SCORE
1 1 1 85.29
2 1 1 61.76
3 4 1 59.35
1 2 0 44.12
2 2 0 58.82
1 3 2 80.88
2 3 2 86.76
1 4 1 42.89
2 4 1 23.53
3 4 1 69.12
1 5 0 79.41
2 5 0 66.18
3 5 0 92.65
1 6 0 69.12
2 6 0 76.47
1 7 2 97.06
2 7 2 97.06
1 8 1 72.06
2 8 1 73.53

How can I use proc means or proc tabulate for this? I'm having trouble getting all the descriptive stats I need


 

Etoo12121
Obsidian | Level 7
exactly what I needed. Thank you @Reeza and @ballardw

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 590 views
  • 0 likes
  • 3 in conversation