Is there a way to put a text box at the beginning of the analysis in the output window in SAS EG (report or html windows)? I do not want to save the results to an html or pdf file using ODS but I want it to go to the output window, and if needed I would like to save the output myself. I do not want it occupying the entire page.
I use the following code and it works fine but the font is too small. Is there a way to change the font or an easier way to do it that does not require too many lines of code. Sample code attached below.
data _null_;
file print;
line1="Data : aaa";
line2="Years of study: xxx";
line3="Outcomes: BBB";
put #1 line1 10-35 #2 line2 10-35 #3 line3 10-35;
file log;
run;
@PamG wrote:
Is there a way to put it in a box with centering of the text?
Centering is easy (add the justify=center option to the title statements). For a kind of box you could add the BCOLOR= option, e.g., bcolor=lightgray.
For a real box, however, you might need to resort to more complex tools such as ODS LAYOUT GRIDDED and PROC GSLIDE, as shown below.
ods layout gridded;
options center;
goptions hsize=200pt vsize=90pt;
proc gslide frame;
note h=12pt;
note h=18pt j=c "Data: aaa";
note h=18pt j=c "Years of study: xxx";
note h=18pt j=c "Outcomes: BBB";
run;
quit;
proc print data=sashelp.class;
run;
ods layout end;
Result:
Hello @PamG,
Try the TITLE statement with a HEIGHT= option.
Example:
title1 height=5 "Data : aaa";
title2 height=4 "Years of study: xxx";
title3 height=3 "Outcomes: BBB";
proc print data=sashelp.class;
run;
title;
The values 5, 4, 3 are relative sizes, but you can specify absolute values like 24pt as well.
Is there a way to put it in a box with centering of the text?
@PamG wrote:
Is there a way to put it in a box with centering of the text?
Centering is easy (add the justify=center option to the title statements). For a kind of box you could add the BCOLOR= option, e.g., bcolor=lightgray.
For a real box, however, you might need to resort to more complex tools such as ODS LAYOUT GRIDDED and PROC GSLIDE, as shown below.
ods layout gridded;
options center;
goptions hsize=200pt vsize=90pt;
proc gslide frame;
note h=12pt;
note h=18pt j=c "Data: aaa";
note h=18pt j=c "Years of study: xxx";
note h=18pt j=c "Outcomes: BBB";
run;
quit;
proc print data=sashelp.class;
run;
ods layout end;
Result:
Perfect!!! This is exactly what I was looking for. Thanks so much @FreelanceReinh
If I do a left justification then text touches the box. Is there a way to put a left margin between the text and the box?
ods layout gridded;
options center;
goptions hsize=200pt vsize=90pt;
proc gslide frame;
note h=12pt;
note h=18pt j=l "Data: aaa";
note h=18pt j=l "Years of study: xxx";
note h=18pt j=l "Outcomes: BBB";
run;
quit;
proc print data=sashelp.class;
run;
ods layout end;
You can add a couple of spaces to each title, but I think there may frame options.
ods layout gridded;
options center;
goptions reset=all;
goptions hsize=200pt vsize=90pt;
proc gslide frame;
note h=12pt;
note h=18pt j=l " Data: aaa";
note h=18pt j=l " Years of study: xxx";
note h=18pt j=l " Outcomes: BBB";
run;
quit;
proc print data=sashelp.class;
run;
ods layout end;
@PamG wrote:
If I do a left justification then text touches the box. Is there a way to put a left margin between the text and the box?
I think adding white-space characters to the text, as suggested by data_null__, is the easiest (if not the only) option -- similar to the first NOTE statement,
note h=12pt;
the purpose of which is to insert space between the text and the top of the box.
Another solution is using PROC REPORT to emulate it .
data title;
title="Data: aaa(*ESC*)nYears of study: xxx(*ESC*)nOutcomes: BBB";
run;
quit;
ods html options(page_break='no');
title;
proc report data=title nowd noheader style(column header report)={
bordercolor=black borderwidth=1
frame=box rules=all
};
run;
proc print data=sashelp.class;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.