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

Hello, 

 

I have the following data set:

Obs Complete_n partial_n Conversion_n Death_n Revised_n declined_n com_par_percent no_res_percent tot_pat_for_comp clin_visit_percent xray_percent faam_percent ffi_percent vr12_percent pt_percent md_percent vas_percent survey_percent
1 59 200 10 10 23 . 50.5859 49.4141 512 36.9141 40 32.5 64.5 64.5 63.5 43 70 53.5

 

I am running the following code:

proc report data = test.test;
title 'August 2017';
column Complete_n partial_n Conversion_n Death_n Revised_n declined_n com_par_percent no_res_percent tot_pat_for_comp
clin_visit_percent xray_percent faam_percent ffi_percent vr12_percent pt_percent md_percent vas_percent
survey_percent;
define complete_n / 'Complete' display;
DEFINE partial_n/ 'Partial' display;
DEFINE com_par_percent/ 'Complete and Partial' display;
DEFINE no_res_percent/ 'No Response' display;
DEFINE Death_n/ 'Dead (#)' display;
DEFINE Revised_n/'Revised (#)' display;
DEFINE Conversion_n/ 'Conversion (#)' display;
DEFINE declined_n/ 'Declined (#)' display;
DEFINE clin_visit_percent/ 'Had a Clinic Visit' display;
DEFINE tot_pat_for_comp/ 'Total Eligible for COmpliance' display;
DEFINE xray_percent/ 'X-ray' display;
DEFINE faam_percent/ 'FAAM' display;
DEFINE ffi_percent/ 'FFI-R' display;
DEFINE vr12_percent/ 'VR-12' display;
DEFINE pt_percent/ 'AOFAS - patient' display;
DEFINE md_percent/ 'AOFAS - physician' display;
DEFINE vas_percent/ 'VAS' display;
DEFINE survey_percent/ 'Survey (orthotics/bracing, smoking, satisfaction questions)' display;
run;

 

It produces: 

Complete Partial Conversion (#) Dead (#) Revised (#) Declined (#) Complete and Partial No Response Total Eligible for COmpliance Had a Clinic Visit X-ray FAAM FFI-R VR-12 AOFAS - patient AOFAS - physician VAS Survey (orthotics
bracing, smoking, satisfaction questions)
59 200 10 10 23 . 50.585938 49.414063 512 36.914063 40 32.5 64.5 64.5 63.5 43 70 53.5

 

Is it possible to modify this code to produce something that looks like below:

 

 

AUG 2017

Complete

59

Partial

200

Complete & Partial

 (50.6%)

No Response

 (49.4%)

*newly:

 

Dead (#)

10

Revised (#)

23

Conversion (#)

9

Declined (#)

-

Total Patients eligible for compliance**

512

Had a Clinic Visit

(31.1%)

Breakdown of “Partial”:

(% Complete)

 

X-ray

40.0%

FAAM

32.5%

FFI-R

64.5%

VR-12

64.5%

AOFAS - patient

63.5%

AOFAS - physician

43.0%

VAS

70.0%

Survey

(orthotics/bracing, smoking, satisfaction questions)

53.5%

 

Basically, I just need to flip the axises so that the column headers and data are vertical and not horizontal. Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

Add appropriate format for each column value to next code:

data have;
   infile cards truncover dlm='09'x dsd;
   input column Complete_n partial_n Conversion_n Death_n Revised_n declined_n 
   com_par_percent no_res_percent tot_pat_for_comp clin_visit_percent xray_percent 
   faam_percent ffi_percent vr12_percent pt_percent md_percent vas_percent survey_percent;
   format _all_ best10.4 ;
cards;
59	200	10	10	23	.	50.5859	49.4141	512	36.9141	40	32.5	64.5	64.5	63.5	43	70	53.5
run;

title 'August 2017';
data _null_;
 set have;
   file print;
   array var {*} _numeric_;
   do i=1 to dim(var);
      name = vname(var(i));
      value = var(i);
      put @3 name @40 value /;
   end;
run;

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Using PROC TRANSPOSE, you can get the data to look like your final table and then PROC PRINT will output it.

--
Paige Miller
Shmuel
Garnet | Level 18

Add appropriate format for each column value to next code:

data have;
   infile cards truncover dlm='09'x dsd;
   input column Complete_n partial_n Conversion_n Death_n Revised_n declined_n 
   com_par_percent no_res_percent tot_pat_for_comp clin_visit_percent xray_percent 
   faam_percent ffi_percent vr12_percent pt_percent md_percent vas_percent survey_percent;
   format _all_ best10.4 ;
cards;
59	200	10	10	23	.	50.5859	49.4141	512	36.9141	40	32.5	64.5	64.5	63.5	43	70	53.5
run;

title 'August 2017';
data _null_;
 set have;
   file print;
   array var {*} _numeric_;
   do i=1 to dim(var);
      name = vname(var(i));
      value = var(i);
      put @3 name @40 value /;
   end;
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 2 replies
  • 617 views
  • 0 likes
  • 3 in conversation