BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mona4u
Lapis Lazuli | Level 10

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

1350735.00%
1601735.00%
1450630.00%
Total Open Issu20100.0%
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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:

report_long_text_rbreak.png

 

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

View solution in original post

4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
The length of SITE_Number has to be increased BEFORE the PROC REPORT step. But I don't see where you are assigning the string "Total Open Issues" on the break and, although I see an RBREAK statement in your code, I don't see a COMPUTE AFTER block. How did you produce the output you show?

Also, no one can run your code because you have not provided your ODS statements or any data.

cynthia
mona4u
Lapis Lazuli | Level 10

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 

Cynthia_sas
SAS Super FREQ

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:

report_long_text_rbreak.png

 

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

mona4u
Lapis Lazuli | Level 10
I changed both the length and the format to be able to display the result.
Thanks so much

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!

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
  • 4 replies
  • 956 views
  • 2 likes
  • 2 in conversation