Help using Base SAS procedures

Creating a report

Reply
Contributor
Posts: 20

Creating a report

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.

                           

Super User
Posts: 11,343

Re: Creating a report

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?

Contributor
Posts: 20

Re: Creating a report

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

How do you suggest I can do this? Thanks.

Trusted Advisor
Posts: 1,228

Re: Creating a report

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;

Super User
Posts: 10,035

Re: Creating a report

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

Super User
Super User
Posts: 7,970

Re: Creating a report

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.

Super User
Posts: 10,035

Re: Creating a report

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

Ask a Question
Discussion stats
  • 6 replies
  • 316 views
  • 6 likes
  • 5 in conversation