BookmarkSubscribeRSS Feed
Inp
Obsidian | Level 7 Inp
Obsidian | Level 7

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;



2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Cynthia_sas
SAS Super FREQ

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 10668 views
  • 0 likes
  • 3 in conversation