BookmarkSubscribeRSS Feed
Lulus
Obsidian | Level 7


Nothing statistics here.

I have a table which is a similaroty matrix, and it looks like this,

abc
a10.80.7
b0.810.2
c0.70.21

I was hoping to do the following,

and let tables become either

Header 1aabbcc
a1a0.8b0.7c
b0.8a1b0.2c
c0.7a0.2b1c

or the transpose of it, doesn't matter.

Header 1ab
a10.8
aaa
b0.81
bbb

As long as I have the original table by row or by column,

seperated by one colume which is fullfilled by the "previous" column name or rowname.

Please let me know how to do this.  Thank you very much.

3 REPLIES 3
ballardw
Super User

Does the value for the text versions of a b and c ever change?

Lulus
Obsidian | Level 7

no, they shouldn't be changed at all. thanks.

ballardw
Super User

If the data in the start table you presented is in a dataset foes this do what you need?

data want;

     set have;

     a_str = 'a';

     b_str = 'b';

     c_str = 'c';

     label a_str = 'a'

             b_str = 'b'

             c_str = 'c'

    ;

run;

proc print data= want noobs label;

     var a a_str b b_str c c_str;

run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 1098 views
  • 1 like
  • 2 in conversation