BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
daszlosek
Quartz | Level 8

Hello,

 

I would like to report the following count data:

TP FN FP TN
12 110 14 99

 

in a proc report as the following:

 

    Gold Standard
    + -
Result + 12 14
- 110 99

 

 

I am having some difficulty as to how I can manipulate the cells/ add rows. I would think this was a common problem, but I am having difficulty googling it. Below is the SAS code for the dataset:

 

 

data ex1;
input TP    FN    FP     TN;
cards;
12 110 14 99
;
run;

 

Any suggestions or links to the right direction would be much appreciated,

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

If you read in your data differently so that each row has only one data point, and a + or - value for Gold Standard, and another + or - value for Result, then you're all set. See http://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=proc&docsetTarget=n1pl56sdqo09...

 

data have;
    input gold_standard $ result $ value;
+ + 12
+ - 110
- + 14
- - 99
;
run;

  

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

If you read in your data differently so that each row has only one data point, and a + or - value for Gold Standard, and another + or - value for Result, then you're all set. See http://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=proc&docsetTarget=n1pl56sdqo09...

 

data have;
    input gold_standard $ result $ value;
+ + 12
+ - 110
- + 14
- - 99
;
run;

  

--
Paige Miller
daszlosek
Quartz | Level 8
I can see that I could just transpose the data to get it into that format, but I am not seeing how, in proc report, I could get the 12 adjacent to the 14. In the past using proc report I have just added columns, not rows.
PaigeMiller
Diamond | Level 26

I gave the link to an example that does this.

--
Paige Miller
daszlosek
Quartz | Level 8
Yes, my apologies didn't see the link. With a little tweaking I was able to format the data the way I wanted.

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
  • 4 replies
  • 1187 views
  • 0 likes
  • 2 in conversation