BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Konkordanz
Pyrite | Level 9

Hi,

within my proc-report-syntax I want to rename the Rbreak-Line into "This is a test". But the result is short: "This i". So: How can I increase the length?

 

Thank you!

 

proc report data=sashelp.cars completerows ;
columns origin make type,(msrp invoice) Differenz;
define origin/group style(column)=[cellwidth=10cm]  style(header)=[background=yellow] ;
define make/ group ;
define type/across;
define msrp/"Mittelwert" mean;
define invoice/"Summe v. Invoice" sum;
define Differenz/computed;
Break after Origin/ summarize style={font_weight=bold};
RBreak after /Summarize;
compute Differenz;
	Differenz= _c3_ - _c4_ ;
endcomp;
compute after origin; 
	if not missing(_break_) then origin= "Gesamt";
endcomp;
compute after;
	if not missing(_break_) then Origin="This is a test";
endcomp;
where origin in("Asia", "Europe");
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Or make a COMPUTED vairable.

 

proc report data=sashelp.cars completerows nowd;
columns origin _origin make type,(msrp invoice) Differenz;
define origin/group style(column)=[cellwidth=10cm]  style(header)=[background=yellow] noprint ;
define _origin/computed style(column)=[cellwidth=10cm]  style(header)=[background=yellow] ;

define make/ group ;
define type/across;
define msrp/"Mittelwert" mean;
define invoice/"Summe v. Invoice" sum;
define Differenz/computed;
Break after Origin/ summarize style={font_weight=bold};
RBreak after /Summarize;
compute Differenz;
	Differenz= _c4_ - _c5_ ;
endcomp;

compute _origin/character length=80;
_origin=origin;
endcomp;

compute after origin; 
	if not missing(_break_) then _origin= "Gesamt";
endcomp;
compute after;
	if not missing(_break_) then _Origin="This is a test";
endcomp;
where origin in("Asia", "Europe");
run;

View solution in original post

5 REPLIES 5
FreelanceReinh
Jade | Level 19

Hi @Konkordanz,

 

Origin is a character variable of length 6 in sashelp.cars, so you will need to increase its length in a preliminary step before you can assign longer values to it:

data cars;
length Origin $14;
set sashelp.cars;
run;

proc report data=cars ...;
...
Ksharp
Super User

Or make a COMPUTED vairable.

 

proc report data=sashelp.cars completerows nowd;
columns origin _origin make type,(msrp invoice) Differenz;
define origin/group style(column)=[cellwidth=10cm]  style(header)=[background=yellow] noprint ;
define _origin/computed style(column)=[cellwidth=10cm]  style(header)=[background=yellow] ;

define make/ group ;
define type/across;
define msrp/"Mittelwert" mean;
define invoice/"Summe v. Invoice" sum;
define Differenz/computed;
Break after Origin/ summarize style={font_weight=bold};
RBreak after /Summarize;
compute Differenz;
	Differenz= _c4_ - _c5_ ;
endcomp;

compute _origin/character length=80;
_origin=origin;
endcomp;

compute after origin; 
	if not missing(_break_) then _origin= "Gesamt";
endcomp;
compute after;
	if not missing(_break_) then _Origin="This is a test";
endcomp;
where origin in("Asia", "Europe");
run;
FreelanceReinh
Jade | Level 19

The insertion of _origin before msrp and invoice in the COLUMN statement changes the column numbers in the formula for Differenz:

 

Differenz= _c4_ - _c5_ ;

 

 

Ksharp
Super User
You are right. Already fixed it.
Konkordanz
Pyrite | Level 9

Thank you for your two options. Both are good!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1223 views
  • 5 likes
  • 3 in conversation