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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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