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
SAS Super FREQ

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

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