BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Yesterday I posted this one. One of the support suggested me to look for examples. I didnot find similar one. Please help thanks.

 

What should I add to my code get output. Thank you.

 

code;

proc report data=one;
column code text ns100 ns200 ns300;
define code/order;
define text/order;
run;

 

data1

 

text                           NS\100                NS\200                             NS\300                  code

 

joint pains                    10                        20                                      30                      Rheumatic

knee pains                    5                          20                                     25                      Rheumatic 

vomiting                       3                           6                                       40                       GE

nausea                        30                          20                                    26                        GE

headche                       4                            5                                      22                       Cardiac

chest pain                     20                          20                                     30                       Cardicac

 

 

Output table needed;

 

term                           NS\100                NS\200                         NS\300 

_________________________________________________________________

Cardiac

   headche                        4                            5                                      22  

   chest pain                     20                          20                                     30

 

Rheumatic

    Joint pains                    10                        20                                      30

     knee pains                    5                          20                                     25

 

GE

    vomiting                       3                           6                                       40

    nausea                        30                          20                                    26

 

 

3 REPLIES 3
ballardw
Super User

If you really want two different variables to appear in the same column that is a LOT of extra work especially if the row with the code value is not supposed to have any summary. Is it acceptable to have a summary for the code group?

 

And is the display order within the values of Text critical? Example would this be acceptable?

GE

    nausea                        

    vomiting          

 

knveraraju91
Barite | Level 11

Thanks for your time. What you said is acceptable. Please provide the code(an example) I will try to get the output.

 

Thank you

Cynthia_sas
Diamond | Level 26

Hi:
This is something you can accomplish with PROC REPORT. You would have to define CODE as an ORDER item with the NOPRINT option and then, in the column for TEXT, you would write the CODE value before the first value for TEXT. There's an example using SASHELP.SHOES below. If you have pre-summarized data, then the same technique will work with ORDER variables as well as GROUP variables.
cynthia

 

show_indent.png

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1286 views
  • 2 likes
  • 3 in conversation