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-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!

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