Hello everyone,
we are generating some pdf reports, in them there are tables generated with proc report.
We are asked if it is possible for the header columns to appear as follows:
The cells above should appear blank.
Right now we are displaying it as follows:
The code:
proc report data=VER STYLE(header)=[ backgroundcolor=#8DB4E2 ] style(header)={verticalalign=middle}; columns ('Tipo de vía' (TIPO_VIA_4F)) ("&anyo2."(muertos&anyo2.)) ("&anyo3."(muertos&anyo3.)) ('Diferencias'(FDIF_&anyo3._&anyo2. )); define TIPO_VIA_4F / order order=data '' STYLE(header)=[backgroundcolor=white] STYLE(column)=[Color=darkblue] display left; define muertos&anyo2. / order order=data 'Nº' display right; define muertos&anyo3. / order order=data 'Nº' display right; define FDIF_&anyo3._&anyo2. / order order=data "&anyo3.-&anyo2." display right; compute muertos&anyo2; if TIPO_VIA_4F = 'TOTAL' then call define (_col_,"style","STYLE=[fontweight=bold]"); Endcomp; compute TIPO_VIA_4F; if TIPO_VIA_4F = 'TOTAL' then call define (_col_,"style","STYLE=[fontweight=bold]"); Endcomp; compute muertos&anyo3; if TIPO_VIA_4F = 'TOTAL' then call define (_col_,"style","STYLE=[fontweight=bold]"); Endcomp; compute FDIF_&anyo3._&anyo2; if TIPO_VIA_4F = 'TOTAL' then call define (_col_,"style","STYLE=[fontweight=bold]"); Endcomp; run;
Thank you very much for the help.
Greetings.
proc format;
value $ fmt
'09'x='white'
other='#8DB4E2 ';
run;
proc report data=sashelp.class
STYLE(header)=[ backgroundcolor=$fmt. ] nowd;
column ("09"x name) ('xxxx' height) ("yyyy" weight);
define name/display ;
run;
@Cristina_inet wrote:
Hello everyone,
we are generating some pdf reports, in them there are tables generated with proc report.
We are asked if it is possible for the header columns to appear as follows:
The cells above should appear blank.
Right now we are displaying it as follows:
The code:
proc report data=VER STYLE(header)=[ backgroundcolor=#8DB4E2 ] style(header)={verticalalign=middle}; columns ('Tipo de vía' (TIPO_VIA_4F)) ("&anyo2."(muertos&anyo2.)) ("&anyo3."(muertos&anyo3.)) ('Diferencias'(FDIF_&anyo3._&anyo2. )); define TIPO_VIA_4F / order order=data '' STYLE(header)=[backgroundcolor=white] STYLE(column)=[Color=darkblue] display left; define muertos&anyo2. / order order=data 'Nº' display right; define muertos&anyo3. / order order=data 'Nº' display right; define FDIF_&anyo3._&anyo2. / order order=data "&anyo3.-&anyo2." display right; compute muertos&anyo2; if TIPO_VIA_4F = 'TOTAL' then call define (_col_,"style","STYLE=[fontweight=bold]"); Endcomp; compute TIPO_VIA_4F; if TIPO_VIA_4F = 'TOTAL' then call define (_col_,"style","STYLE=[fontweight=bold]"); Endcomp; compute muertos&anyo3; if TIPO_VIA_4F = 'TOTAL' then call define (_col_,"style","STYLE=[fontweight=bold]"); Endcomp; compute FDIF_&anyo3._&anyo2; if TIPO_VIA_4F = 'TOTAL' then call define (_col_,"style","STYLE=[fontweight=bold]"); Endcomp; run;Thank you very much for the help.
Greetings.
*remove header text from column statement;
columns (TIPO_VIA_4F) ("&anyo2."(muertos&anyo2.)) ("&anyo3."(muertos&anyo3.)) ('Diferencias'(FDIF_&anyo3._&anyo2. ));
*Add the text here;
define TIPO_VIA_4F / order order=data 'Tipo de vía' STYLE(header)=[backgroundcolor=white] STYLE(column)=[Color=darkblue] display left;Th
This is untested.
proc format;
value $ fmt
'09'x='white'
other='#8DB4E2 ';
run;
proc report data=sashelp.class
STYLE(header)=[ backgroundcolor=$fmt. ] nowd;
column ("09"x name) ('xxxx' height) ("yyyy" weight);
define name/display ;
run;
That is a cool trick. But it would be better to use something like 'A0'x instead of a TAB. Then it won't mess up the normal listing output column alignments.
Tom,
But if I use '0A'x ,I got this under unicode sas or Chinese sas. (HTML destination)
Not sure why you used a LINEFEED. Not sure why Chinese encoding would display a character for either a linefeed or a non-breaking space. Are you use double byte character set? If so you probably need to two byte character.
Why not just use a normal space then?
Tom,
Opps. It is typo.
I am from China.
So I have to use multi byte character set,like Chines or UTF-8 .
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.