Hi ,
I am trying to change the attributes of the text at the line statment(in this example , TEST1 , TEST2, TEST3 AND TEST4) from the Proc template , but I tried many ways ,but not able to do so. Can you please let me know how to do this. What is needed to be changed in the proc template. Attached my coding. I am using SAS 9.2 and OS is Z/OS.
data temp;
input x $1. y 2. z 1.;
cards;
a112
a114
b121
c113
run;
PROC TEMPLATE;
DEFINE STYLE NEWSTYLE;
PARENT = STYLES.SASWEB;
*PARENT = STYLES.NORMAL;
STYLE FONTS FROM FONTS/
"DOCFONT" = ("Calibri",3)
"TITLEFONT"=("Cambria",4);
;
STYLE HEADER FROM HEADER /
JUST = CENTER
FONT_WEIGHT=BOLD
FOREGROUND=WHITE
BACKGROUND=#D81E05
;
STYLE SYSTEMTITLE FROM SYSTEMTITLE /
JUST = CENTER
FONT_WEIGHT=BOLD
FOREGROUND=#D81E05;
;
STYLE SYSTEMFOOTER FROM SYSTEMFOOTER /
JUST = LEFT
BACKGROUND=WHITE
FOREGROUND=BLUE;
*STYLE DATA FROM DATA /
JUST=LEFT
;
END;
RUN;
filename test 'C:\TMP\TEST.xls';
ODS _ALL_ CLOSE;
ODS TAGSETS.EXCELXP FILE=test STYLE=NEWSTYLE RS=NONE ;
ODS TAGSETS.EXCELXP OPTIONS(
ORIENTATION='LANDSCAPE'
SHEET_NAME='MASTER'
EMBEDDED_TITLES='YES'
ROW_HEIGHTS = '50'
EMBED_TITLES_ONCE='YES'
ABSOLUTE_COLUMN_WIDTH='10,10,10'
);
TITLE ' THIS IS TEST STATMENT';
options missing = ' ';
proc report data=temp nowd ;
column x y z ;
define x / 'x';
define y / 'y';
define z / 'Z' ;
COMPUTE BEFORE _PAGE_;
LINE @1 'TEST1';
LINE @2 'TEST2';
ENDCOMP;
RBREAK AFTER /SUMMARIZE;
COMPUTE z ;
IF _BREAK_ = '_RBREAK_' THEN
do;
z.sum=.;
x='T';
end;
ENDCOMP;
COMPUTE AFTER / RIGHT;
LINE @1 'TEST3';
LINE @2 'TEST4';
ENDCOMP;
run;
ODS _ALL_ CLOSE;
ODS LISTING;
Proc template is general for the whole output. What you want is call style. Read these:
http://www2.sas.com/proceedings/sugi27/p187-27.pdf
https://support.sas.com/resources/papers/stylesinprocs.pdf
Oh, and coding all in upper case, with no indetations and such like makes you code very hard to read.
Hi,
PROC REPORT, I think, uses the NoteContent Style element -- so your template is probably not setting the correct element.
I generally recommend that you try defining the LINE style in the PROC REPORT statement first before moving into TEMPLATE. You could set a default in the PROC REPORT statement and then use a different style specification on a COMPUTE statement.
cynthia
** in the code below, a default is set and then different LINES will get different styles.;
** you cannot do this in PROC TEMPLATE;
proc report data=sashelp.class
style(lines)={color=purple font_size=14pt};
compute before _page_ / style={font_size=10pt};
line 'BEFORE PAGE';
endcomp;
compute before / style={font_size=8pt color=red just=l};
line 'BEFORE DATA';
endcomp;
compute after _page_ / style={color=blue};
line 'AFTER PAGE';
endcomp;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.