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!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 5 replies
  • 438 views
  • 5 likes
  • 3 in conversation