<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to substitue REPLACE statement in DEFINE STYLE statement in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39879#M5499</link>
    <description>Cynthina,&lt;BR /&gt;
Thank you for the explanation.&lt;BR /&gt;
&lt;BR /&gt;
Here is my question:&lt;BR /&gt;
If style element A inherits from style element B.&lt;BR /&gt;
Can I change the attribute of B but do not affect A.&lt;BR /&gt;
&lt;BR /&gt;
If 9.2, if I change the foreground color of B, A will change accordingly.&lt;BR /&gt;
I remember 9.1 can do it (using STYLE or REPLACE? I am not sure which one is the right statement.).&lt;BR /&gt;
&lt;BR /&gt;
May be I am wrong.&lt;BR /&gt;
&lt;BR /&gt;
My question is how to change B's specific attribute while do not affect child style element A in SAS 9.2.&lt;BR /&gt;
&lt;BR /&gt;
-Kevin

Message was edited by: Kevin Qin</description>
    <pubDate>Thu, 14 Jan 2010 07:48:13 GMT</pubDate>
    <dc:creator>KevinQin</dc:creator>
    <dc:date>2010-01-14T07:48:13Z</dc:date>
    <item>
      <title>How to substitue REPLACE statement in DEFINE STYLE statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39877#M5497</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I think REPLACE statement is very useful. It can update a style element and do not affect other style elements. However, it has been removed from SAS 9.2&lt;BR /&gt;
&lt;BR /&gt;
Here is my question:&lt;BR /&gt;
How can I substitue REPLACE statement in SAS 9.2&lt;BR /&gt;
&lt;BR /&gt;
In my opinion, if I want to modify style element A, I have to follow the steps at below:&lt;BR /&gt;
1. identify what style elements inherit from A.&lt;BR /&gt;
2. create a new duplicate style element A_dup and switch all inheritance relationship from A to A_dup&lt;BR /&gt;
3. modify style element A using CLASS statement.&lt;BR /&gt;
&lt;BR /&gt;
What is your opinion?</description>
      <pubDate>Wed, 13 Jan 2010 09:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39877#M5497</guid>
      <dc:creator>KevinQin</dc:creator>
      <dc:date>2010-01-13T09:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to substitue REPLACE statement in DEFINE STYLE statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39878#M5498</link>
      <description>Hi:&lt;BR /&gt;
  In the documentation for the REPLACE statement, it says that:&lt;BR /&gt;
&lt;B&gt;If you use the REPLACE statement to create a style element in the new style definition, all style elements that inherit from that element inherit the definition that is in the new style definition. If you want to keep any attributes that are specified in the definition that is in the parent, &lt;U&gt;you must respecify them in the definition that you create in the child style definition.&lt;/U&gt;&lt;/B&gt;&lt;BR /&gt;
From the 9.1.3 doc as outlined here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/base/early-access/odsdoc2/sashtml/tw5195/z1072349.htm" target="_blank"&gt;http://support.sas.com/rnd/base/early-access/odsdoc2/sashtml/tw5195/z1072349.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
One reason for using REPLACE in 9.1.3 is that if you used the STYLE statement WITHOUT the correct FROM, inheritance did not cascade down to all the child elements, especially in situations with multiple parent templates involved. The use of REPLACE, especially with respecifying, allowed inheritance to happen after the style changes were applied. For example, if you only needed to change 2 colors in the color list, if you used REPLACE, and only specified the 2 colors, all the other colors in the color list would be undefined and would take on a default value. If you used REPLACE, you had to respecify ALL the colors including the 2 colors you wanted to change.&lt;BR /&gt;
 &lt;BR /&gt;
I'm not clear on why you think that the CLASS statement is -more- work than the REPLACE statement. In prior versions of SAS, you -did- have to trace inheritance. In SAS 9.2, I find that I do NOT have to do much inheritance tracing at all, in order to make my change. I just have to know what the style element is that needs to change. Compare these ways to make the header foreground color purple:&lt;BR /&gt;
[pre]&lt;BR /&gt;
** 9.2 syntax:&lt;BR /&gt;
style Header /&lt;BR /&gt;
  foreground=purple;&lt;BR /&gt;
        &lt;BR /&gt;
class Header /&lt;BR /&gt;
  foreground=purple;&lt;BR /&gt;
                                 &lt;BR /&gt;
style Header from _self_/&lt;BR /&gt;
  foreground = purple;&lt;BR /&gt;
                                &lt;BR /&gt;
** 9.1.3 syntax:&lt;BR /&gt;
style Header from HeadersandFooters /&lt;BR /&gt;
  foreground = purple;&lt;BR /&gt;
                                       &lt;BR /&gt;
replace Header /&lt;BR /&gt;
   foreground=purple&lt;BR /&gt;
   background=white&lt;BR /&gt;
   font= fonts('HeadingFont');&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                                            &lt;BR /&gt;
You should find in SAS 9.2 that every element that inherits from Header will now show a color of purple, no matter which statement form you use. In SAS 9.1.3, different ways of specifying STYLE or REPLACE would have an adverse impact on inheritance -- sometimes you'd get purple, sometimes you wouldn't. That's the reason that REPLACE went away. For more information about the new syntax, refer to:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi31/053-31.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi31/053-31.pdf&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
For help with a specific style template or the conversion of a 9.1.3 style template to a 9.2 style template, you might wish to work with Tech Support. In my experience, when converting from SAS 9.1.3 to SAS 9.2 syntax, my templates got shorter using the CLASS statement.&lt;BR /&gt;
 &lt;BR /&gt;
You say you find it useful to update a style element, but not have an impact on other style elements. That seems to defeat the purpose of having inheritance in the first place. I'm not sure you have an issue with the REPLACE statement. It sounds to me like you need to define an entirely new style element and then point to that style element for the report pieces where you don't want any impact from inheritance.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 13 Jan 2010 16:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39878#M5498</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-01-13T16:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to substitue REPLACE statement in DEFINE STYLE statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39879#M5499</link>
      <description>Cynthina,&lt;BR /&gt;
Thank you for the explanation.&lt;BR /&gt;
&lt;BR /&gt;
Here is my question:&lt;BR /&gt;
If style element A inherits from style element B.&lt;BR /&gt;
Can I change the attribute of B but do not affect A.&lt;BR /&gt;
&lt;BR /&gt;
If 9.2, if I change the foreground color of B, A will change accordingly.&lt;BR /&gt;
I remember 9.1 can do it (using STYLE or REPLACE? I am not sure which one is the right statement.).&lt;BR /&gt;
&lt;BR /&gt;
May be I am wrong.&lt;BR /&gt;
&lt;BR /&gt;
My question is how to change B's specific attribute while do not affect child style element A in SAS 9.2.&lt;BR /&gt;
&lt;BR /&gt;
-Kevin

Message was edited by: Kevin Qin</description>
      <pubDate>Thu, 14 Jan 2010 07:48:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39879#M5499</guid>
      <dc:creator>KevinQin</dc:creator>
      <dc:date>2010-01-14T07:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to substitue REPLACE statement in DEFINE STYLE statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39880#M5500</link>
      <description>Hi:&lt;BR /&gt;
   The fact that you could bypass inheritance depending on whether you used a STYLE statement or a REPLACE statement was considered to be unacceptable/undesirable behavior by most style template writers. So the underlying assumption (in making REPLACE go away) was to make sure that inheritance was resolved in style templates more like the resolution in CSS (Cascading Style Sheets). The intent is to make sure that a child element changes when a parent element changes -- that's the whole point of inheritance.&lt;BR /&gt;
 &lt;BR /&gt;
  If you wanted a child element NOT to change when a parent element changed, that would bypass the inheritance entirely.  You could accidentally achieve this behavior in earlier versions of SAS -- usually, by using a STYLE statement without a FROM.&lt;BR /&gt;
&lt;BR /&gt;
  I guess I'd do a couple of different things if you needed a PARENT element to have one set of characteristics and wanted the child element to have another set of characteristics. Let's say you have specifically Header and RowHeader. RowHeader inherits from Header. Note that I am picking "concrete" elements -- these are elements whose color changes you can see in the resulting output. It is harder to give a practical example when talking about "abstract" elements like Cell or Container. Since I don't know -specifically- which elements you do or don't want to change, I picked elements that are quickly visible in an output table. Header controls the Header style of the columns going from left to right in the output results. RowHeader controls the style of the rightmost area, where the OBS column is in PROC PRINT or the row headers and class levels are in PROC TABULATE.&lt;BR /&gt;
 &lt;BR /&gt;
  The code below shows the following:&lt;BR /&gt;
1 - Use inheritance to change both Header and RowHeader. Style template only explicitly changes Header.&lt;BR /&gt;
2 - Change Header colors down in the CLASS statement and point RowHeader to the color list for the original colors.&lt;BR /&gt;
3 - Change the color_list element, which both Header and RowHeader inherit from -- so Header gets one set of colors and RowHeader gets another set of colors.&lt;BR /&gt;
4 - Change Header colors directly in the CLASS statement, but point RowHeader to the HeadersandFooters element, which still points to the original colors.&lt;BR /&gt;
5 - Don't use inheritance at all and define a style template from "scratch" -- this was much harder to do in SAS 9.1.3 -- but is easy to do in SAS 9.2 because you only have to define the style elements you need.&lt;BR /&gt;
 &lt;BR /&gt;
 If you need help converting a 9.1.3 style template to a 9.2 style template in order to achieve specific results for a particular destination, your best resource is to open a track with Tech Support.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods path work.temp(update)&lt;BR /&gt;
         sashelp.tmplmst(read);&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
                  &lt;BR /&gt;
**1;&lt;BR /&gt;
proc template;&lt;BR /&gt;
  define style styles.same;&lt;BR /&gt;
  parent=styles.sasweb;&lt;BR /&gt;
  class Header/&lt;BR /&gt;
    background=pink&lt;BR /&gt;
    foreground=purple;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
               &lt;BR /&gt;
ods html file='c:\temp\make_same.html' style=styles.same;&lt;BR /&gt;
                       &lt;BR /&gt;
proc tabulate data=sashelp.class;&lt;BR /&gt;
  title '1 - Using STYLES.SAME';&lt;BR /&gt;
  class age;&lt;BR /&gt;
  var height;&lt;BR /&gt;
  table age,&lt;BR /&gt;
        height*(min mean max);&lt;BR /&gt;
run;&lt;BR /&gt;
             &lt;BR /&gt;
proc print data=sashelp.class(obs=2);&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
ods html close;&lt;BR /&gt;
                         &lt;BR /&gt;
**2; &lt;BR /&gt;
proc template;&lt;BR /&gt;
  define style styles.diff;&lt;BR /&gt;
  parent=styles.sasweb;&lt;BR /&gt;
  class Header/&lt;BR /&gt;
    background=pink&lt;BR /&gt;
    foreground=purple;&lt;BR /&gt;
  class RowHeader /&lt;BR /&gt;
    background=color_list('bgA1')&lt;BR /&gt;
    foreground=color_list('bgA');&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
                      &lt;BR /&gt;
ods html file='c:\temp\make_diff.html' style=styles.diff;&lt;BR /&gt;
                        &lt;BR /&gt;
proc tabulate data=sashelp.class;&lt;BR /&gt;
  title '2 - Using STYLES.DIFF';&lt;BR /&gt;
  class age;&lt;BR /&gt;
  var height;&lt;BR /&gt;
  table age,&lt;BR /&gt;
        height*(min mean max);&lt;BR /&gt;
run;&lt;BR /&gt;
             &lt;BR /&gt;
proc print data=sashelp.class(obs=2);&lt;BR /&gt;
run;&lt;BR /&gt;
                  &lt;BR /&gt;
ods html close;&lt;BR /&gt;
                            &lt;BR /&gt;
**3;&lt;BR /&gt;
proc template;&lt;BR /&gt;
  define style styles.altdiff;&lt;BR /&gt;
  parent=styles.sasweb;&lt;BR /&gt;
  class color_list /                                 &lt;BR /&gt;
     'bgA1' = cx6495ED                                                    &lt;BR /&gt;
     'bgA' = cxffffff&lt;BR /&gt;
     'newfg' = purple&lt;BR /&gt;
     'newbg' = pink;  &lt;BR /&gt;
  class Header /&lt;BR /&gt;
    background=color_list('newbg')&lt;BR /&gt;
    foreground=color_list('newfg');&lt;BR /&gt;
  class RowHeader /&lt;BR /&gt;
    background=color_list('bgA1')&lt;BR /&gt;
    foreground=color_list('bgA');&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
                           &lt;BR /&gt;
ods html file='c:\temp\make_altdiff.html' style=styles.altdiff;&lt;BR /&gt;
                                 &lt;BR /&gt;
proc tabulate data=sashelp.class;&lt;BR /&gt;
  title '3 - Using STYLES.ALTDIFF';&lt;BR /&gt;
  class age;&lt;BR /&gt;
  var height;&lt;BR /&gt;
  table age,&lt;BR /&gt;
        height*(min mean max);&lt;BR /&gt;
run;&lt;BR /&gt;
               &lt;BR /&gt;
proc print data=sashelp.class(obs=2);&lt;BR /&gt;
run;&lt;BR /&gt;
                         &lt;BR /&gt;
ods html close;&lt;BR /&gt;
                          &lt;BR /&gt;
** 4;&lt;BR /&gt;
proc template;&lt;BR /&gt;
  define style styles.othrdiff;&lt;BR /&gt;
  parent=styles.sasweb;&lt;BR /&gt;
  class Header /&lt;BR /&gt;
    background=pink&lt;BR /&gt;
    foreground=purple;&lt;BR /&gt;
  class RowHeader from HeadersandFooters/;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
                            &lt;BR /&gt;
ods html file='c:\temp\make_othrdiff.html' style=styles.othrdiff;&lt;BR /&gt;
                               &lt;BR /&gt;
proc tabulate data=sashelp.class;&lt;BR /&gt;
  title '4 - Using STYLES.OTHRDIFF';&lt;BR /&gt;
  class age;&lt;BR /&gt;
  var height;&lt;BR /&gt;
  table age,&lt;BR /&gt;
        height*(min mean max);&lt;BR /&gt;
run;&lt;BR /&gt;
                        &lt;BR /&gt;
proc print data=sashelp.class(obs=2);&lt;BR /&gt;
run;&lt;BR /&gt;
                      &lt;BR /&gt;
ods html close;&lt;BR /&gt;
                     &lt;BR /&gt;
** 5;&lt;BR /&gt;
proc template;&lt;BR /&gt;
  define style styles.scratch;&lt;BR /&gt;
  class Header /&lt;BR /&gt;
    background=pink&lt;BR /&gt;
    foreground=purple&lt;BR /&gt;
    font=("&lt;SANS-SERIF&gt;, Helvetica, sans-serif",2,bold);&lt;BR /&gt;
  class RowHeader /&lt;BR /&gt;
    background=cx6495ED&lt;BR /&gt;
    foreground=white&lt;BR /&gt;
    font=("&lt;SANS-SERIF&gt;, Helvetica, sans-serif",2,bold);&lt;BR /&gt;
  class SystemTitle /&lt;BR /&gt;
    foreground = cx003399 &lt;BR /&gt;
    background=white&lt;BR /&gt;
    font=("&lt;SANS-SERIF&gt;, Helvetica, sans-serif",4,bold);&lt;BR /&gt;
  class Body /&lt;BR /&gt;
    background=white;&lt;BR /&gt;
  class Data /&lt;BR /&gt;
    foreground=black&lt;BR /&gt;
    background=white&lt;BR /&gt;
    font=("&lt;SANS-SERIF&gt;, Helvetica, sans-serif",2,medium);&lt;BR /&gt;
  class Table /&lt;BR /&gt;
    backgroundcolor = cxcccccc   &lt;BR /&gt;
    rules = none&lt;BR /&gt;
    frame = box&lt;BR /&gt;
    borderspacing = 1&lt;BR /&gt;
    bordercollapse = separate&lt;BR /&gt;
    bordercolor = black&lt;BR /&gt;
    cellpadding = 7;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
                      &lt;BR /&gt;
ods html file='c:\temp\make_scratch.html' style=styles.scratch;&lt;BR /&gt;
               &lt;BR /&gt;
proc tabulate data=sashelp.class;&lt;BR /&gt;
  title '5 - Using STYLES.SCRATCH (no Parent Statment and no inheritance)';&lt;BR /&gt;
  class age;&lt;BR /&gt;
  var height;&lt;BR /&gt;
  table age,&lt;BR /&gt;
        height*(min mean max);&lt;BR /&gt;
run;&lt;BR /&gt;
                         &lt;BR /&gt;
proc print data=sashelp.class(obs=2);&lt;BR /&gt;
run;&lt;BR /&gt;
                     &lt;BR /&gt;
ods html close;&lt;BR /&gt;
                &lt;BR /&gt;
title;&lt;BR /&gt;
footnote;&lt;BR /&gt;
            &lt;BR /&gt;
                      &lt;BR /&gt;
[/pre]&lt;/SANS-SERIF&gt;&lt;/SANS-SERIF&gt;&lt;/SANS-SERIF&gt;&lt;/SANS-SERIF&gt;</description>
      <pubDate>Thu, 14 Jan 2010 17:08:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39880#M5500</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-01-14T17:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to substitue REPLACE statement in DEFINE STYLE statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39881#M5501</link>
      <description>Cynthia, &lt;BR /&gt;
Yeah, it works.&lt;BR /&gt;
Thank you.&lt;BR /&gt;
&lt;BR /&gt;
-Kevin</description>
      <pubDate>Mon, 18 Jan 2010 09:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-substitue-REPLACE-statement-in-DEFINE-STYLE-statement/m-p/39881#M5501</guid>
      <dc:creator>KevinQin</dc:creator>
      <dc:date>2010-01-18T09:12:15Z</dc:date>
    </item>
  </channel>
</rss>

