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

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

@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:

boxed_title.png

View solution in original post

8 REPLIES 8
FreelanceReinh
Jade | Level 19

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.

PamG
Quartz | Level 8

Is there a way to put it in a box with centering of the text?

FreelanceReinh
Jade | Level 19

@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:

boxed_title.png

PamG
Quartz | Level 8

Perfect!!! This is exactly what I was looking for.  Thanks so much @FreelanceReinh 

PamG
Quartz | Level 8

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;

 

data_null__
Jade | Level 19

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;
FreelanceReinh
Jade | Level 19

@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.

Ksharp
Super User

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;

Ksharp_0-1760799637916.png

 

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
  • 8 replies
  • 2064 views
  • 8 likes
  • 4 in conversation