<?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 get proc report to format missing values and correctly order dates? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812730#M320680</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Under 01/03/2021, you can see there is a '.' missing value. Is there any way to format this so it is a 0?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options missing=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or create a custom format.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2022 17:15:05 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-05-11T17:15:05Z</dc:date>
    <item>
      <title>How to get proc report to format missing values and correctly order dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812727#M320677</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have some output from proc report that looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Table2.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71330i0AE8F19161682B14/image-size/large?v=v2&amp;amp;px=999" role="button" title="Table2.png" alt="Table2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Under 01/03/2021, you can see there is a '.' missing value. Is there any way to format this so it is a 0?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition, you can see that the 2020 months are at the end of the table rather than the beginning. Is there any way to change this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=Merged out=a;
	
	column SC1 SC2 SC3 SC4 ap_month,(Probability);
	
	define ap_month / Across;
	define SC1 / Group;
	define SC2 / Group;
	define SC3 / Group;
	define SC4 / Group;
	define Probability / sum;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and the data looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EC27556_0-1652288789607.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71333i0EE564CEE670FDBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EC27556_0-1652288789607.png" alt="EC27556_0-1652288789607.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You can see that in between the highlighted rows there should be another row with 01/03/2021 and this is the root cause of the missing value in the table.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 17:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812727#M320677</guid>
      <dc:creator>EC27556</dc:creator>
      <dc:date>2022-05-11T17:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc report to format missing values and correctly order dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812730#M320680</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Under 01/03/2021, you can see there is a '.' missing value. Is there any way to format this so it is a 0?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options missing=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;or create a custom format.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 17:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812730#M320680</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-05-11T17:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc report to format missing values and correctly order dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812736#M320684</link>
      <description>&lt;P&gt;Why are you ordering the columns by month/day? (or is that day/month)? instead of the actual date?&lt;/P&gt;
&lt;P&gt;If AP_MONTH is a date variable then use ORDER=INTERNAL to order by the date.&lt;/P&gt;
&lt;P&gt;If AP_MONTH is a character string then store the dates in the string in Year-Month-Date order instead so they will sort properly (and also to prevent confusing half of your audience).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 17:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812736#M320684</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-11T17:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc report to format missing values and correctly order dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812737#M320685</link>
      <description>&lt;P&gt;Thanks, two questions re. this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) if i use options missing=0, is there a way of changing options back to default (where missing=.) other than just running&amp;nbsp;options missing=.;&amp;nbsp; ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) How exactly would I go about using a default format in proc report? I have tried to run&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
	value Probability .=0;
run;


proc report data=Merged out=a;
	
	column SC1 SC2 SC3 SC4 ap_month,(Probability);
	
	define ap_month / Across;
	define SC1 / Group;
	define SC2 / Group;
	define SC3 / Group;
	define SC4 / Group;
	define Probability / sum format=probability.;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;but this just makes every value in my output table = 0!&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 17:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812737#M320685</guid>
      <dc:creator>EC27556</dc:creator>
      <dc:date>2022-05-11T17:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc report to format missing values and correctly order dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812738#M320686</link>
      <description>&lt;P&gt;Ahh yes sorry, this is dd/mm/yyyy. order=internal has sorted, thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 17:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812738#M320686</guid>
      <dc:creator>EC27556</dc:creator>
      <dc:date>2022-05-11T17:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc report to format missing values and correctly order dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812739#M320687</link>
      <description>&lt;P&gt;Hi: &lt;BR /&gt;System options missing=0 will help with the 0. But if you want the dates to be in a different order, you'd have to do something like: sort by ap_month before the PROC REPORT step and then use order=internal on your DEFINE statement.&lt;BR /&gt;Something like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1652290772885.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71336iDC515B18D2141F85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1652290772885.png" alt="Cynthia_sas_0-1652290772885.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I see that you're using OUT= with PROC REPORT. With ACROSS items, that is going to cause absolute column numbers to appear in the output dataset. You can deal with them easily, but just something to be aware of. If you change the ORDER= option then that will change what the columns represent.&lt;BR /&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 17:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812739#M320687</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-05-11T17:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc report to format missing values and correctly order dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812743#M320688</link>
      <description>&lt;P&gt;Thanks Cynthia,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In terms of resetting Options to default after I have run my proc report, is there a standard way of doing this or would you just write Options Missing=.; to reset?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 17:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812743#M320688</guid>
      <dc:creator>EC27556</dc:creator>
      <dc:date>2022-05-11T17:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc report to format missing values and correctly order dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812747#M320691</link>
      <description>&lt;P&gt;Your format has no default width, so SAS will set the default to 1 character!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input grp yrmon :yymmdd. value ;
  format yrmon yymm7.;
cards;
1 2020-12-01 100
1 2021-01-02 200
2 2020-12-10 3000
2 2021-01-01 .
;

proc format;
  value zeromiss .='0' other=[comma12.2];
run;

proc report data=test;
  column grp value,yrmon ;
  define grp / group;
  define yrmon / across order=internal;
  define value / sum ' ' format=zeromiss.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1652291372121.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71339iB143DEB2250640B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1652291372121.png" alt="Tom_0-1652291372121.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 17:49:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812747#M320691</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-11T17:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proc report to format missing values and correctly order dates?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812750#M320692</link>
      <description>Hi, that's the standard way to do it. &lt;BR /&gt;cynthia</description>
      <pubDate>Wed, 11 May 2022 17:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-proc-report-to-format-missing-values-and-correctly/m-p/812750#M320692</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2022-05-11T17:57:11Z</dc:date>
    </item>
  </channel>
</rss>

