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


 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 684 views
  • 0 likes
  • 2 in conversation