I'm trying proc report code and it's truncated Total Open Issues on the table
I hope I can find a way to display the whole string I tried to increase the length of site_number but it didn't work
Please advise me
this is the code that's I'm running
proc report data=&Queries.2;
length SITE_NUMBER $25;
column SITE_NUMBER sitenum calcpct ;
define SITE_NUMBER/ display"Top 3 Sites with highest # issues";
define sitenum/ "# Open Issues";
define calcpct/ computed 'Percent' format=percent8.2;
compute after;
SITE_NUMBER='Total Open Issues';
endcomp;
COMPUTE before;
holdtot=sitenum.sum;
endcomp;
compute calcpct;
calcpct= sitenum.sum/ holdtot ;
endcomp;
rbreak after / summarize ;
run;
and this is my output
Top 3 Sites with highest # issues # Open Issues Percent
1350 | 7 | 35.00% |
1601 | 7 | 35.00% |
1450 | 6 | 30.00% |
Total Open Issu | 20 | 100.0% |
Hi:
Sorry, I missed the COMPUTE AFTER in your code. I only see a LENGTH statement inside the PROC REPORT step. I meant something like this:
Notice how with Report #1, I only get the first letter of my COMPUTE AFTER string, because the length of the SEX variable in SASHELP.CLASS is $1. However, for #2 report, I am able to put "Gender Summary" as the text string at the end of the report because I have changed the length of the SEX variable in a DATA step program. There are a couple of other ways to solve this issue, but this is the most straightforward for beginners.
Here's the code that generated the output above.
proc report data=sashelp.class;
title '1) not big enough for AFTER text because length of SEX variable is only $1';
column sex n pctn age height;
define sex / group;
define n / 'Count';
define pctn / 'Percent' f=percent9.2;
define age / 'Avg Age' mean f=6.2;
define height / 'Avg Height' mean f=6.2;
rbreak after / summarize;
compute after;
sex='Gender Summary';
endcomp;
run;
data newclass;
length sex $15;
set sashelp.class;
run;
proc report data=newclass;
title '2) now length good for AFTER text';
column sex n pctn age height;
define sex / group;
define n / 'Count';
define pctn / 'Percent' f=percent9.2;
define age / 'Avg Age' mean f=6.2;
define height / 'Avg Height' mean f=6.2;
rbreak after / summarize;
compute after;
sex='Gender Summary';
endcomp;
run;
Hope this explains what I mean about changing the length BEFORE the PROC REPORT step.
Cynthia
Hi Cynthina,
every thing is there in my code. I tried t increase the length by length statement and by format statement before proc report and it didn't work
Hi:
Sorry, I missed the COMPUTE AFTER in your code. I only see a LENGTH statement inside the PROC REPORT step. I meant something like this:
Notice how with Report #1, I only get the first letter of my COMPUTE AFTER string, because the length of the SEX variable in SASHELP.CLASS is $1. However, for #2 report, I am able to put "Gender Summary" as the text string at the end of the report because I have changed the length of the SEX variable in a DATA step program. There are a couple of other ways to solve this issue, but this is the most straightforward for beginners.
Here's the code that generated the output above.
proc report data=sashelp.class;
title '1) not big enough for AFTER text because length of SEX variable is only $1';
column sex n pctn age height;
define sex / group;
define n / 'Count';
define pctn / 'Percent' f=percent9.2;
define age / 'Avg Age' mean f=6.2;
define height / 'Avg Height' mean f=6.2;
rbreak after / summarize;
compute after;
sex='Gender Summary';
endcomp;
run;
data newclass;
length sex $15;
set sashelp.class;
run;
proc report data=newclass;
title '2) now length good for AFTER text';
column sex n pctn age height;
define sex / group;
define n / 'Count';
define pctn / 'Percent' f=percent9.2;
define age / 'Avg Age' mean f=6.2;
define height / 'Avg Height' mean f=6.2;
rbreak after / summarize;
compute after;
sex='Gender Summary';
endcomp;
run;
Hope this explains what I mean about changing the length BEFORE the PROC REPORT step.
Cynthia
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.
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.