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;
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...)
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.
It is not rounded as i attached the final dataset and it has values which are different
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.
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?
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
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...)
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.