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

I am using proc report and using across and analysis and while getting the final output i get values as 1 for all which should not be the case. any help where i am going wrong?

 

sample data attached

 

proc report data = inc out=ngf nowd split = "¤" headline missing contents = "";
          column rpt_varn rpt_var  actarm rpt_cat count dummy ;
          define actarm / group style(header)={just=left cellwidth=1.5cm} style(column)=IdColIndent2{asis=on} "Description of Actual Arm";
          define rpt_cat / across order=internal style(header)={just=center } style(column)=IdColIndent2{asis=on};
          define rpt_varn / group order=internal noprint;
          define rpt_var / group style={just=left cellwidth=3.5cm} " ";
          define count /analysis  sum style={just=right cellwidth=1.57142857142856cm} " ";
          define dummy /noprint;
          compute before;
          line @1 ' ';
          endcomp;
          compute after rpt_varn;
          line ' ';
          endcomp;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You might want to try

column rpt_varn rpt_var  actarm rpt_cat, count dummy ;

The , after rpt_cat says that you want to summarize count for each level of rpt_cat.

 

Since you didn't actually have any values associated with rep_cat it was, I believe, defaulting to an N statistic as the variable rpt_cat is character and that is the default statistic for character (hard to sum character variables...)

View solution in original post

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

It sounds like it is being rounded, do you have values of 0.xx?  Apply a format to the one in question.  Or do your calculations in a datastep and keep the proc report simple - this is what I do, don't like doing data manipulation in an output procedure.

vraj1
Quartz | Level 8

It is not rounded as i attached the final dataset and it has values which are different

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I didn't say the data was rounded, as you are doing calculations in the proc report the data within the proc report may get rounded.  One very good reason not to do calculations and data processing in an output procedure.  Put out= onto your proc report step and see the data being used there, if that looks ok, then check your output destination - Excel for instance is a constent offender on "features" which destroy your data - for instance, rounding and truncation.

ballardw
Super User

I have to say that specifying a cell width of

1.57142857142856cm

 

Appears to be a tad bit of overkill. You are trying to control width of something to about the width of a single ink molecule and significantly less than the width of single pixels on a monitor even a very high resolution one.

 

Can you see any actual difference in the output if you use 1.57cm?

 

vraj1
Quartz | Level 8

I still get the same result if i make it to 1.57cm. somehow i get all 1's and wondering from where it is evolving

ballardw
Super User

You might want to try

column rpt_varn rpt_var  actarm rpt_cat, count dummy ;

The , after rpt_cat says that you want to summarize count for each level of rpt_cat.

 

Since you didn't actually have any values associated with rep_cat it was, I believe, defaulting to an N statistic as the variable rpt_cat is character and that is the default statistic for character (hard to sum character variables...)

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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
  • 1030 views
  • 1 like
  • 3 in conversation