<?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 Automatic Proc Report and missing columns in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362452#M64550</link>
    <description>&lt;P&gt;Hi all&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a small query that some of you might have already encoutered re: Proc report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a report the get generated weekly automatically. Pb is that last week, the data was a bit different and 1 category ('Female' wasn't present in the file. That was normal but I hadn't cater for it in teh automatic report and an error was generated (see error below).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Usual in-file 'rep0' format = _NAME_ male female&lt;/P&gt;&lt;P&gt;This week 'rep0' format = _NAME_ male&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking of going the roundabout way of creating dummy cols of '0' whenever a category was missing - but there might be a cleverer idea out there &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data = rep0 nowd style(header)=[font_size=2] missing ;&lt;BR /&gt;columns ("Excellent title" _NAME_ maley female) ;&lt;BR /&gt;define _NAME_ / ' ' left style(column)=[cellwidth=5.0cm] display ;&lt;BR /&gt;define male/ 'Males' format=10.0 center style(column)=[cellwidth=5.5cm]&amp;nbsp;display ;&lt;BR /&gt;define female/ 'Females' format=10.0 center style(column)=[cellwidth=5.5cm]&amp;nbsp;display ; run ; quit ;&lt;BR /&gt;ERROR: Variable female is not on file WORK.REP0.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE REPORT used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;</description>
    <pubDate>Mon, 29 May 2017 10:14:18 GMT</pubDate>
    <dc:creator>MrTh</dc:creator>
    <dc:date>2017-05-29T10:14:18Z</dc:date>
    <item>
      <title>Automatic Proc Report and missing columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362452#M64550</link>
      <description>&lt;P&gt;Hi all&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a small query that some of you might have already encoutered re: Proc report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a report the get generated weekly automatically. Pb is that last week, the data was a bit different and 1 category ('Female' wasn't present in the file. That was normal but I hadn't cater for it in teh automatic report and an error was generated (see error below).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Usual in-file 'rep0' format = _NAME_ male female&lt;/P&gt;&lt;P&gt;This week 'rep0' format = _NAME_ male&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking of going the roundabout way of creating dummy cols of '0' whenever a category was missing - but there might be a cleverer idea out there &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data = rep0 nowd style(header)=[font_size=2] missing ;&lt;BR /&gt;columns ("Excellent title" _NAME_ maley female) ;&lt;BR /&gt;define _NAME_ / ' ' left style(column)=[cellwidth=5.0cm] display ;&lt;BR /&gt;define male/ 'Males' format=10.0 center style(column)=[cellwidth=5.5cm]&amp;nbsp;display ;&lt;BR /&gt;define female/ 'Females' format=10.0 center style(column)=[cellwidth=5.5cm]&amp;nbsp;display ; run ; quit ;&lt;BR /&gt;ERROR: Variable female is not on file WORK.REP0.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE REPORT used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 10:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362452#M64550</guid>
      <dc:creator>MrTh</dc:creator>
      <dc:date>2017-05-29T10:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Proc Report and missing columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362464#M64551</link>
      <description>&lt;P&gt;Force having both genders in dataset before running proc report.&lt;/P&gt;
&lt;P&gt;Assuming gender is one character then:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data rep0;
 set rep0;
      length male female $1; /* adapt length to origin */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 May 2017 11:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362464#M64551</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-05-29T11:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Proc Report and missing columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362467#M64552</link>
      <description>&lt;P&gt;Thanks #Shmuel - that's the option I went for.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 11:08:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362467#M64552</guid>
      <dc:creator>MrTh</dc:creator>
      <dc:date>2017-05-29T11:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Proc Report and missing columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362525#M64557</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; For the sake of completeness, when you are using PROC REPORT, you have 2 options inside PROC REPORT that can help you with this scenario. By default, as shown in Report #1, when I ask PROC REPORT to show me the count of students, for each SEX within each AGE, there is no F row for Age 16 because the data does not have a female for age 16.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; But, as shown in Report #2, if I add the COMPLETEROWS option, then PROC REPORT "completes" all the rows the same, based on the values it finds in the data. So, with the COMPLETEROWS option added, there is now a row for F under Age 16 with a count of 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9122i532D2D6BE57AD0D4/image-size/original?v=1.0&amp;amp;px=-1" alt="use_completerows.png" title="use_completerows.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; But what if I want to see rows for ages 17-20 because I know that for some data files, I will have those ages, but for other data files, I might not have those ages. One way is to "seed" a copy of the data will all the possible values to show on the report. Another option that works for PROC REPORT, TABULATE and a few others is the PRELOADFMT option, which allows you to specify a format that contains the combinations you want to see on the report. Report #3 shows the use of PRELOADFMT with COMPLETEROWS to get ages 17-20 with values for F and M for each age.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9123i89962CC76C712D7E/image-size/original?v=1.0&amp;amp;px=-1" alt="completerows_preloadfmt.png" title="completerows_preloadfmt.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;In some circumstances, you might prefer to seed the data to contain all combinations for variables, this is a technique that I often use when I need to put a category value on a graph, but the data does not have that value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 15:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362525#M64557</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-05-29T15:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Proc Report and missing columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362530#M64559</link>
      <description>&lt;P&gt;Hi Cynthia&lt;/P&gt;&lt;P&gt;I really appreciathe the compleness of your reply - the PRELOADFMT sounds a very good alternative that I will try. Many thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 15:57:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Proc-Report-and-missing-columns/m-p/362530#M64559</guid>
      <dc:creator>MrTh</dc:creator>
      <dc:date>2017-05-29T15:57:04Z</dc:date>
    </item>
  </channel>
</rss>

