BookmarkSubscribeRSS Feed
lyton80
Obsidian | Level 7

Hi,

I think this might be easy but I am having problems generating the report,

I have a data quality report dataset A with vars

field_name Pcnt_Complete   Faclity_name,

Age           100(20%)                 Facility1

Age            40(10%)                  Facility2

DOB          10(5%)                     Facility1

DOB          10(5%)                     Facility2

I want a report using proc report/proc tabulate like this

                                      Pcnt_Complete

Facility_name               Age             DOB

Facility1                   100(20%)         10(5%)

Facility2                    40(10%)          10(5%)

I have tried several approaches in proc report but I am getting 1's in the cells and the values as column names.

Thanks in advance.

                           

6 REPLIES 6
ballardw
Super User

Does your Pcnt_Complet variable have a string value such  as 100(20%) OR is it two separate numeric that you want to appear that way in the table?

If strings you are likely getting a count of 1 because there is only one of each combination

Did you generate this data or was it provided? If you generated it  then it may be better to go back a few steps and avoid this one?

lyton80
Obsidian | Level 7

I generated the string by concatenating with the % complete value.

How do you suggest I can do this? Thanks.

stat_sas
Ammonite | Level 13

If your data is without (%) in Pcnt_Complete then desired output can be generated as

data have;
input field_name $ Pcnt_Complete Faclity_name $12.;
datalines;
Age     100  Facility1
Age      40   Facility2
DOB    10   Facility1
DOB    10   Facility2
;

proc tabulate data=have;
class field_name Faclity_name;
var Pcnt_Complete;
table Faclity_name,Pcnt_Complete*field_name=' '*sum=' ';
run;

Ksharp
Super User
data have;
input (field_name Pcnt_Complete   Faclity_name) ( : $40.);
cards;
Age           100(20%)                 Facility1
Age            40(10%)                  Facility2
DOB          10(5%)                     Facility1
DOB          10(5%)                     Facility2
;
run;
proc report data=have nowd;
columns Faclity_name Pcnt_Complete,field_name ;
define      Faclity_name/group;
define      Pcnt_Complete/group;
define field_name/across ' ' ;

run;

Xia Keshan

RW9
Diamond | Level 26 RW9
Diamond | Level 26

How would you then get two separate programmers to QC the output?  My opinion is the data should reflect the output as much as possible so a proc compare can be done hence get the data looking like the output then minimal information in the report, then maybe a cosmetic view of the output for review.  Of course if you don't need to validate it then this is irrelevant.

Ksharp
Super User

I don't know what you mean. OP has already said those variable are character variable not numeric .

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 6 replies
  • 1306 views
  • 6 likes
  • 5 in conversation