BookmarkSubscribeRSS Feed
zqkal
Obsidian | Level 7

I’m creating a title page. Here is how I started. I enter all the information into a sas dataset and then read in the dataset using proc reports and apply style format using call define statement. Somehow it’s not giving me the style format I specified. Does anyone know what I’m doing wrong?

Here is what I want:

1st line:  font_size 16, Calibri, Bold, background= Blue ,color=white

2nd line:  font_size 12, Calibri, Blue ,color=white

3rd line:  font_size 12, Calibri, Blue ,color=white

4th line:  font_size 12, Calibri, Blue ,color=white

5th – 9th line: font_size 12, Calibri, light Blue ,color=Darkblue

Here is what I have. Can you please help?

ods listing close;

  ods escapechar="^";

  ods tagsets.ExcelXP

      file="&path./&file_name."

      style=festival

      options(orientation='portrait'

              skip_space = '2,0,0,0,0');

%let run_date = %sysfunc(today(),mmddyy10.);

data cover_page;

        length line $200. ;

        do i= 1 to 28;

            if i = 1  then line="Daily report " ;

            if i = 2  then line="Version: DM0203: ";

            if i = 3  then line="Report Run on:&run_date.";

            if i = 4  then line="                        ";

            if i = 5  then line="List of Views:";

            if i = 6  then line=">> Report1  ";

            if i = 7  then line=">> Report2 ";

            if i = 8  then line=">> Detail1  ";

            if i = 9  then line=">> Detail2  ";

   output;

drop I;

end;

run;

ods tagsets.excelXP

       options(sheet_name='Cover Page'

               width_fudge='.0625'

               width_points='12'

               absolute_column_width='600'

               Fittopage='Yes'

               skip_space ='2,0,0,0,0'

               Pages_FitWidth = '1'

               pages_Fitheight = '1'

               embedded_titles='Yes'

               center_vertical='Yes'

               center_horizontal='Yes'

               autofit_height='Yes');

title;

proc report noheader nowd data=kdev.cover_page;

  column line;

   define line /display ' ';

   compute line;

    rownum= obsno + 1;

      if rownum =1 then do;

         Call Define(_row_,'STYLE','STYLE={color=white font_face=calibri font_wight=Bold fontfontsize=16 background=#366092}');

      end;

      if rownum =2 then do;

         Call Define(_row_,'STYLE','STYLE={color=white font_face=calibri fontsize=12 background=#366092}');

      end;

      if rownum =3 then do;

         Call Define(_row_,'STYLE','STYLE={color=white font_face=calibri fontsize=12 background=#366092}');

      end;

      if rownum =4 then do;

         Call Define(_row_,'STYLE','STYLE={color=#366092 font_face=calibri fontsize=12 background=#366092}');

      end;

      if rownum =5 then do;

         Call Define(_row_,'STYLE','STYLE={color=#366092 font_face=calibri forntsize=12 background=#DCE6F1}');

      end;

      if rownum =6 then do;

         Call Define(_row_,'STYLE','STYLE={color=#366092 font_face=calibri forntsize=12 background=#DCE6F1}');

      End;

 

       if rownum =7 then do;

         Call Define(_row_,'STYLE','STYLE={color=#366092 font_face=calibri forntsize=12 background=#DCE6F1}');

      end;

      if rownum =8 then do;

         Call Define(_row_,'STYLE','STYLE={color=#366092 font_face=calibri forntsize=12 background=#DCE6F1}');

      end;

      if rownum =9 then do;

         Call Define(_row_,'STYLE','STYLE={color=#366092 font_face=calibri forntsize=12 background=#DCE6F1}');

      end;

endcomp;

run;

ods tagsets.ExcelXP;

ods listing;

1 REPLY 1
Cynthia_sas
Diamond | Level 26

Hi:

  Did you look in your log? Were there any notes or messages about uninitialized variables? Where do you create the OBSNO variable? I do not see it in the COVER_PAGE creation program. My guess is that your test on ROWNUM isn't working because OBSNO doesn't exist. You could fix this easily, by putting OBSNO in the program where you create COVER_PAGE (Instead of dropping the loop var I). I would also expect that the misspelled "forntsize" will cause you a problem, too.

  You are also missing a "close" at the bottom of the code...should be ODS TAGSETS.EXCELXP CLOSE;

cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1235 views
  • 0 likes
  • 2 in conversation