BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
forumsguy
Fluorite | Level 6

Hi Guys,

I want to produce report something like the one attached with this. I know that we must use proc template but how can I apply the rules to have column lines only after first row.

Any help is really appreciable

picture.bmp

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  I was able to do something similar using the first 7 observations in SASHELP.CLASS. See attached screen shot. No special template was necessary. I used STYLE= overrides. You probably could package something similar into a style template, but you'd either need to set up special CSS style selectors or you'd have to set up template style elements for the different ways for the data cells to have lines; which, to me, is probably not worth the learning curve unless you are already comfortable with CSS and/or style templates.

  I think there's still some tweaking needed and I don't think that I would probably bother to use a style template since PROC REPORT seems to work pretty well. It was easier for me to make the OBSCNT variable in order to change the colors and lines (instead of the NAME values); although if you are using fixed values for your first column, you could probably use those values for your test.

  Produced with SAS 9.3 and ODS PDF and opened in Acrobat Reader X.

cynthia

ods listing close;

data class;

  set sashelp.class(obs=7);

  keep obscnt name sex charage;

  obscnt = _n_;

  if _n_ = 1 then charage = put(age,2.0);

  else charage = ' ';

run;

%let bigstyl = %str(bordertopcolor=white borderbottomcolor=white borderleftcolor=black borderrightcolor=white borderwidth=2);

options nodate nonumber;

ods pdf file='c:\temp\chgllines.pdf' notoc ;

  proc report data=class nowd

    style(header)={background=white foreground=black

                   borderwidth=2};

    column obscnt name sex charage ;

          define obscnt / order noprint;

          define name /display "Dimension Value"

           style(header)={background=white foreground=black

                          bordertopcolor=white borderbottomcolor=white

                          borderleftcolor=white borderrightcolor=black

                          borderwidth=2}

           style(column)={background=white foreground=black

                          bordertopcolor=white borderbottomcolor=white

                          borderleftcolor=white borderrightcolor=black

                          borderwidth=2};

          define sex / display "Measure From First Fact";

          define charage / display "Measure From Second Fact";

          compute charage;

            if obscnt in (1,7) then do;

              if obscnt = 1 then do;

        call define('sex','style',"style={background=cx90ee90}");

        call define('charage','style',"style={background=cx90ee90 borderbottomcolor=black}")

     end;

     else if obscnt = 7 then do;

          call define('sex','style',"style={background=cx90ee90}");

          call define('charage','style',"style={background=white &bigstyl}");

     end;

            end;

            else if obscnt in (2, 3,4,5,6) then do;

      call define('sex','style',"style={background=cyan}");

      call define('charage','style',"style={background=white &bigstyl}");

   end;

          endcomp;

run;

ods _all_ close;


change_interior.jpg

View solution in original post

4 REPLIES 4
Cynthia_sas
SAS Super FREQ

Hi:

  You might be able to do this report with ODS LAYOUT and/or PROC REPORT. The key will be that you will have to turn off the interior table lines ... and borders for the cells on the rows underneath the Type 1 row. I see another, different issue -- getting that space underneath the table headers will be problematic because SAS expects that it will have the headers sitting on top of the data rows...not have a space underneath them.

  Actually, I wouldn't approach this as a template problem until I had experimented with PROC REPORT and style= overrides for bordertopstyle, borderbottomstyle,etc -- and I believe you need at least SAS 9.2 to accomplish or use those style attributes.

  You might want to work with Tech Support on this, since setting the individual cell borders for the different columns will need to be accomplished based on the report procedure you are using for this report (PROC REPORT, PROC TABULATE, DATA step, etc).

cynthia

forumsguy
Fluorite | Level 6

Cynthia,

Thanks for guidelines. I am working with Proc Report and I have my dataset ready with the same structure  and we are not worried about the color schemes or the space between first row and second row. My only concern is to have vertical lines limited only to first column from second row onwards... Any further comments from your side would be really helpful ....

Cynthia_sas
SAS Super FREQ

Hi:

  I was able to do something similar using the first 7 observations in SASHELP.CLASS. See attached screen shot. No special template was necessary. I used STYLE= overrides. You probably could package something similar into a style template, but you'd either need to set up special CSS style selectors or you'd have to set up template style elements for the different ways for the data cells to have lines; which, to me, is probably not worth the learning curve unless you are already comfortable with CSS and/or style templates.

  I think there's still some tweaking needed and I don't think that I would probably bother to use a style template since PROC REPORT seems to work pretty well. It was easier for me to make the OBSCNT variable in order to change the colors and lines (instead of the NAME values); although if you are using fixed values for your first column, you could probably use those values for your test.

  Produced with SAS 9.3 and ODS PDF and opened in Acrobat Reader X.

cynthia

ods listing close;

data class;

  set sashelp.class(obs=7);

  keep obscnt name sex charage;

  obscnt = _n_;

  if _n_ = 1 then charage = put(age,2.0);

  else charage = ' ';

run;

%let bigstyl = %str(bordertopcolor=white borderbottomcolor=white borderleftcolor=black borderrightcolor=white borderwidth=2);

options nodate nonumber;

ods pdf file='c:\temp\chgllines.pdf' notoc ;

  proc report data=class nowd

    style(header)={background=white foreground=black

                   borderwidth=2};

    column obscnt name sex charage ;

          define obscnt / order noprint;

          define name /display "Dimension Value"

           style(header)={background=white foreground=black

                          bordertopcolor=white borderbottomcolor=white

                          borderleftcolor=white borderrightcolor=black

                          borderwidth=2}

           style(column)={background=white foreground=black

                          bordertopcolor=white borderbottomcolor=white

                          borderleftcolor=white borderrightcolor=black

                          borderwidth=2};

          define sex / display "Measure From First Fact";

          define charage / display "Measure From Second Fact";

          compute charage;

            if obscnt in (1,7) then do;

              if obscnt = 1 then do;

        call define('sex','style',"style={background=cx90ee90}");

        call define('charage','style',"style={background=cx90ee90 borderbottomcolor=black}")

     end;

     else if obscnt = 7 then do;

          call define('sex','style',"style={background=cx90ee90}");

          call define('charage','style',"style={background=white &bigstyl}");

     end;

            end;

            else if obscnt in (2, 3,4,5,6) then do;

      call define('sex','style',"style={background=cyan}");

      call define('charage','style',"style={background=white &bigstyl}");

   end;

          endcomp;

run;

ods _all_ close;


change_interior.jpg
forumsguy
Fluorite | Level 6

Superb.... thanks a ton .... I applied same logic to my code and it worked like wonders....

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