BookmarkSubscribeRSS Feed
AKHILA
Obsidian | Level 7

i have a dataset like;

TRT        VAR1   VAR2     VAR3     VAR4        VAR5

  A             12      34            56        White     male

  B             34      65            98        white      male

  A              12      55            34        White     female

  A              21     62            72         White     male

  B              64     32            31         white      female

-          __      ____      _____  ___ _ _ _ _ 

................................................

................................................

 like this i am having some 100 records

the required o/p is as in the image shown in which

1. the min-Max  and q1-q3 value should be combined as 'Min-max' and 'Q1-Q3'

2.var4 and var5 are character values whose statistics should be calculated along with percentages in braces.

3. The column "ALL'' also need to be calculated.

2019-04-03-15-46-32-802.jpg

1 REPLY 1
Reeza
Super User

There isn't anything out of the box that does this - primarily because everyone wants their own method. 

 

Here's a macro that gets pretty close that you can modify, with some work.

https://gist.github.com/statgeek/2f27939fd72d1dd7d8c8669cd39d7e67

 

If you search on lexjansen.com for "table of characteristics or table 1" you'll find several other solutions. I usually find the one closest to what I need and go from there.

 


@AKHILA wrote:

i have a dataset like;

TRT        VAR1   VAR2     VAR3     VAR4        VAR5

  A             12      34            56        White     male

  B             34      65            98        white      male

  A              12      55            34        White     female

  A              21     62            72         White     male

  B              64     32            31         white      female

-          __      ____      _____  ___ _ _ _ _ 

................................................

................................................

 like this i am having some 100 records

the required o/p is as in the image shown in which

1. the min-Max  and q1-q3 value should be combined as 'Min-max' and 'Q1-Q3'

2.var4 and var5 are character values whose statistics should be calculated along with percentages in braces.

3. The column "ALL'' also need to be calculated.

2019-04-03-15-46-32-802.jpg


 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 377 views
  • 0 likes
  • 2 in conversation