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;
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;
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 ...; ...
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;
The insertion of _origin before msrp and invoice in the COLUMN statement changes the column numbers in the formula for Differenz:
Differenz= _c4_ - _c5_ ;
Thank you for your two options. Both are good!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: