<?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: &amp;quot;file print ods&amp;quot; formatting. in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34913#M5063</link>
    <description>Hi:&lt;BR /&gt;
  All good and valid points. Here's how I deal with them.&lt;BR /&gt;
     &lt;BR /&gt;
  The code pasting issue is sort of a pain, but here's how I get around it:&lt;BR /&gt;
  1) Cut and paste the code from the Forum into Word.&lt;BR /&gt;
  2) Word apparently recognizes the line breaks in the code that's inside the [ pre] and [/ pre] tags&lt;BR /&gt;
  3) Then cut and paste from Word into SAS and SAS recognizes the line breaks from Word -and- respects the indentation.&lt;BR /&gt;
&lt;BR /&gt;
  I have just learned to live with &amp;amp;lt; &amp;lt; oddity. That's what find and replace is designed for. I never use the Quote button. I have the pre tags in a notepad file, I cut and paste them from there.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Wed, 27 May 2009 23:26:57 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2009-05-27T23:26:57Z</dc:date>
    <item>
      <title>"file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34905#M5055</link>
      <description>This is a 2-stage question. I think stage 1 might be easier, but I could be wrong.&lt;BR /&gt;
&lt;BR /&gt;
1- Is there a way to apply traffic-lighting (color) in a data step that writes to an (html) ODS destination (no, I cannot use a procedure)?&lt;BR /&gt;
&lt;BR /&gt;
eg I want Alice in red:&lt;BR /&gt;
&lt;BR /&gt;
ods html file='f:\ddd.htm' style=seaside;  &lt;BR /&gt;
data _null_;&lt;BR /&gt;
  set sashelp.class;&lt;BR /&gt;
  file print ods=(variables=( _N_ age name));&lt;BR /&gt;
  put _ods_ ;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
&lt;BR /&gt;
2-Also, is there a way to reuse the stylesheet's style so the first column _N_ uses the header formatting (bold on yellow background here) ?&lt;BR /&gt;
&lt;BR /&gt;
Thank you for your help.</description>
      <pubDate>Thu, 21 May 2009 03:56:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34905#M5055</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-05-21T03:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34906#M5056</link>
      <description>Hi:&lt;BR /&gt;
  If you use a table template with DATA _NULL_ and FILE PRINT ODS, then you can perform the traffic-lighting and highlighting (using style elements) that you describe.&lt;BR /&gt;
  Refer to this paper:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi30/088-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/088-30.pdf&lt;/A&gt;&lt;BR /&gt;
Programs are downloadable from:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/papers/sugi30/data_null.zip" target="_blank"&gt;http://support.sas.com/rnd/papers/sugi30/data_null.zip&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
There are other examples in the ODS FAQ, if you search the Tech Support site and the ODS tip sheet for DATA _NULL_ is:&lt;BR /&gt;
&lt;A href="http://support.sas.com/rnd/base/ods/scratch/table-tips.pdf" target="_blank"&gt;http://support.sas.com/rnd/base/ods/scratch/table-tips.pdf&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 21 May 2009 14:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34906#M5056</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-05-21T14:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34907#M5057</link>
      <description>oooh! Beautiful!  Thanks Cynthia.&lt;BR /&gt;
&lt;BR /&gt;
Stage 2 solved, but stage 1 not quite: using a template before hand would require that the red values are known. &lt;BR /&gt;
&lt;BR /&gt;
The red values are determined in the data step, so I need a way to format on the fly. I do it by inserting &amp;lt;span style=&amp;gt;&amp;lt;/span&amp;gt; around the value at the moment, which is a good-enough workaround for html output.&lt;BR /&gt;
&lt;BR /&gt;
Any better way?&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: C. Graffeuille

Message was edited by: C. Graffeuille</description>
      <pubDate>Thu, 21 May 2009 23:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34907#M5057</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-05-21T23:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34908#M5058</link>
      <description>Oh, one last tip please: I need to output several tables from my data step. How do I tell ODS that a new table starts? I tried a number of solutions, like providing a new object name in successive file print ods statements, but I didnt succeed.</description>
      <pubDate>Fri, 22 May 2009 00:35:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34908#M5058</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-05-22T00:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34909#M5059</link>
      <description>Hi:&lt;BR /&gt;
  I'm not sure what you mean by a new table??? Will this work for you:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods html file='twotable.html';&lt;BR /&gt;
      &lt;BR /&gt;
  data step for table 1;&lt;BR /&gt;
            &lt;BR /&gt;
  data step for table 2;&lt;BR /&gt;
           &lt;BR /&gt;
ods html close;&lt;BR /&gt;
            &lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                                                 &lt;BR /&gt;
The table template does not support BY group processing as far as I know -- so if you wanted a new table for every BY group, I believe that you'd need a separate data step for every BY group -OR- of course, you could macro-ize your data step program.&lt;BR /&gt;
                                  &lt;BR /&gt;
About your other question about how to set the color dynamically, I would think that some combination of CELLSTYLE...AS with user-defined formats might be dynamic enough for you.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
** example of using data step logic to set;&lt;BR /&gt;
** traffic lighting values;&lt;BR /&gt;
ods path work.temps(update)&lt;BR /&gt;
         sashelp.tmplmst(read);&lt;BR /&gt;
                                       &lt;BR /&gt;
proc template;&lt;BR /&gt;
  define table twocol;&lt;BR /&gt;
  column name dc age;&lt;BR /&gt;
  define name;&lt;BR /&gt;
    header = 'Name';&lt;BR /&gt;
  end;&lt;BR /&gt;
  define dc;&lt;BR /&gt;
    print=on;&lt;BR /&gt;
    *print=off;&lt;BR /&gt;
  end;&lt;BR /&gt;
  define age;&lt;BR /&gt;
    header = 'Age';&lt;BR /&gt;
    cellstyle dc = 'reg' as {background=pink},&lt;BR /&gt;
              dc = 'hi' as {background=red},&lt;BR /&gt;
              dc = 'both' as {background=blue foreground=yellow},&lt;BR /&gt;
                 1 as Data;&lt;BR /&gt;
  end;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
                          &lt;BR /&gt;
ods html file='c:\temp\dyncolr.html' style=sasweb;&lt;BR /&gt;
  data _null_;&lt;BR /&gt;
    length dc $4;&lt;BR /&gt;
    set sashelp.class;&lt;BR /&gt;
&lt;BR /&gt;
    ** use data step logic to decide;&lt;BR /&gt;
    ** what background color a variable gets;&lt;BR /&gt;
    ** the DC variable can be used in CELLSTYLE...AS;&lt;BR /&gt;
    ** to "Decide Color" -- after making sure it works;&lt;BR /&gt;
    ** turn PRINT=OFF in table template;&lt;BR /&gt;
    if sex = 'F' then dc = 'reg';&lt;BR /&gt;
    else if sex = 'M' then dc = 'hi';&lt;BR /&gt;
    if sex = 'M' and age = 16 then dc = 'both';&lt;BR /&gt;
    if age = 15 then dc = ' ';&lt;BR /&gt;
                                         &lt;BR /&gt;
    file print ods=(template='twocol'&lt;BR /&gt;
                   columns=(name &lt;BR /&gt;
                            dc &lt;BR /&gt;
                            age)&lt;BR /&gt;
                    );&lt;BR /&gt;
    put _ods_;&lt;BR /&gt;
   run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
                 &lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 22 May 2009 05:46:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34909#M5059</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-05-22T05:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34910#M5060</link>
      <description>Thanks a lot again, Cynthia, the dynamic color assignment logic is interesting, I have to look at it.&lt;BR /&gt;
&lt;BR /&gt;
Regarding the new table, I would be after something like:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods html file='twotable.html';    &lt;BR /&gt;
&lt;BR /&gt;
data step ;             &lt;BR /&gt;
&lt;BR /&gt;
  file print ods statement for table x;&lt;BR /&gt;
  ...logic to populate table1 (probably involving loop, array, hash table) &lt;BR /&gt;
  file print ods statement for table x+1;&lt;BR /&gt;
   ...logic to populate table2&lt;BR /&gt;
 &lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
where 2 new tables are written out at each iteration, for example</description>
      <pubDate>Tue, 26 May 2009 21:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34910#M5060</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-05-26T21:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34911#M5061</link>
      <description>Hi:&lt;BR /&gt;
  I don't think your way will work (produce 2 tables with one data step). The table template is ONLY going to make one table per template. Since the data step does not perform BY group processing your only choices are:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods html file='twotable.html';&lt;BR /&gt;
    data step for table 1;&lt;BR /&gt;
                      &lt;BR /&gt;
    data step for table 2;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
            &lt;BR /&gt;
OR, if both tables are using the SAME table template and you can define the logical terms for creating each table separately, you could:&lt;BR /&gt;
&lt;BR /&gt;
           &lt;BR /&gt;
     [pre]&lt;BR /&gt;
ods html file='twotable.html';&lt;BR /&gt;
      macro invocation to generate both tables&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre] &lt;BR /&gt;
     &lt;BR /&gt;
as shown below.&lt;BR /&gt;
&lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
%macro dotbbl(tabnum=1, whcls=);&lt;BR /&gt;
                     &lt;BR /&gt;
  title "Table Number: &amp;amp;tabnum";&lt;BR /&gt;
  title2 "Criteria: &amp;amp;whcls";&lt;BR /&gt;
  %let varlist=;     &lt;BR /&gt;
                         &lt;BR /&gt;
  %if &amp;amp;tabnum = 1 %then %do;&lt;BR /&gt;
      %let varlist = name sex height;&lt;BR /&gt;
  %end;&lt;BR /&gt;
  %else %if &amp;amp;tabnum = 2 %then %do;&lt;BR /&gt;
      %let varlist = sex name height age;&lt;BR /&gt;
  %end;&lt;BR /&gt;
  %else %if &amp;amp;tabnum = 3 %then %do;&lt;BR /&gt;
     %let varlist = name sex age height weight;&lt;BR /&gt;
  %end;&lt;BR /&gt;
                                &lt;BR /&gt;
  %put -----&amp;gt; varlist is &amp;amp;varlist ;&lt;BR /&gt;
&lt;BR /&gt;
                     &lt;BR /&gt;
  ** of course, your data _null_ step could;&lt;BR /&gt;
  ** be more complicated and use a custom table template;&lt;BR /&gt;
                                   &lt;BR /&gt;
  data _null_;&lt;BR /&gt;
    set sashelp.class;&lt;BR /&gt;
    where &amp;amp;whcls;&lt;BR /&gt;
    file print ods=(variables=( &amp;amp;varlist ));&lt;BR /&gt;
    put _ods_;&lt;BR /&gt;
  run;  &lt;BR /&gt;
                     &lt;BR /&gt;
%mend dotbbl;&lt;BR /&gt;
                  &lt;BR /&gt;
options nosymbolgen nomprint nomlogic;&lt;BR /&gt;
ods html file='maketables.html' style=sasweb;&lt;BR /&gt;
   %dotbbl(tabnum=1, whcls = age eq 13);&lt;BR /&gt;
   %dotbbl(tabnum=2, whcls = sex eq 'F');&lt;BR /&gt;
   %dotbbl(tabnum=3, whcls = name contains 'Al');&lt;BR /&gt;
ods html close;&lt;BR /&gt;
&lt;BR /&gt;
                &lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 27 May 2009 01:30:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34911#M5061</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-05-27T01:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34912#M5062</link>
      <description>Thank you very much for your comprehensive and clear replies, Cynthia.&lt;BR /&gt;
&lt;BR /&gt;
I'll stick to writing HTML directly it seems as all the calculations do need to happen in one data step. No big deal, it is clean and it works.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
A few rough things that could be better about the &lt;U&gt;technical&lt;/U&gt; format of this forum:&lt;BR /&gt;
- One has to type the &amp;amp;lt; code to type &amp;lt;. Not good!&lt;BR /&gt;
- A 'Code' button inserting [ pre ] tags would be nice&lt;BR /&gt;
- The 'Quote' button's action is crude compared to normal forum behaviour&lt;BR /&gt;
- Copying and pasting your code to sas (XP) pastes a single line. Going thru wordpad restores the line breaks, but loses the indentation.&lt;BR /&gt;
Just my 0.02&lt;BR /&gt;
&lt;BR /&gt;
Thanks again.</description>
      <pubDate>Wed, 27 May 2009 21:54:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34912#M5062</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-05-27T21:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34913#M5063</link>
      <description>Hi:&lt;BR /&gt;
  All good and valid points. Here's how I deal with them.&lt;BR /&gt;
     &lt;BR /&gt;
  The code pasting issue is sort of a pain, but here's how I get around it:&lt;BR /&gt;
  1) Cut and paste the code from the Forum into Word.&lt;BR /&gt;
  2) Word apparently recognizes the line breaks in the code that's inside the [ pre] and [/ pre] tags&lt;BR /&gt;
  3) Then cut and paste from Word into SAS and SAS recognizes the line breaks from Word -and- respects the indentation.&lt;BR /&gt;
&lt;BR /&gt;
  I have just learned to live with &amp;amp;lt; &amp;lt; oddity. That's what find and replace is designed for. I never use the Quote button. I have the pre tags in a notepad file, I cut and paste them from there.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 27 May 2009 23:26:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34913#M5063</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-05-27T23:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34914#M5064</link>
      <description>Hi Cynthia,&lt;BR /&gt;
&lt;BR /&gt;
I was hoping you'd be able to pass this on to the java developer who maintains the web site.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers</description>
      <pubDate>Thu, 28 May 2009 20:56:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34914#M5064</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-05-28T20:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34915#M5065</link>
      <description>Hi:&lt;BR /&gt;
  Everything you noted has already been shared.&lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 28 May 2009 21:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34915#M5065</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-05-28T21:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: "file print ods" formatting.</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34916#M5066</link>
      <description>Thank you!</description>
      <pubDate>Thu, 28 May 2009 21:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/quot-file-print-ods-quot-formatting/m-p/34916#M5066</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-05-28T21:52:11Z</dc:date>
    </item>
  </channel>
</rss>

