<?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: Creating an ordered format through cntlin in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409597#M19755</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/39872"&gt;@sasiscool&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;So i can't just create a dataset with the most recent year descending, save it as a format with&amp;nbsp;cntlin. And apply that to the proc report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can do this, but that wasn't clear to me when I first read your question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would need to add in an order though, ie Apple = 1, Cherry = 2. Your current example has start=label which doesn't really create a format you want. So, you could create that and apply it to your data using PROC REPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an idea - untested:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myformat;

set have;

label=put(_n_, z2.);;
start=start;
type = 'C';
fmtname = 'myFmt.';''

run;

proc format cntlin=myFormat;
run;

proc report data=myReportData nowd;
column ...... ;

define fruit  / f=$myFmt. order=formatted

run;;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 01 Nov 2017 19:23:57 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-11-01T19:23:57Z</dc:date>
    <item>
      <title>Creating an ordered format through cntlin</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409562#M19750</link>
      <description>&lt;P&gt;I have a data set of counts of products that I set up in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;label&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; start&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fmtname&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;etc.&amp;nbsp; &amp;nbsp;freq.&lt;/P&gt;&lt;P&gt;apple&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;apple&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$prodfmt&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 40&lt;/P&gt;&lt;P&gt;cherry&amp;nbsp; &amp;nbsp; &amp;nbsp; cherry&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;$prodfmt&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;37&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;pen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;$prodfmt&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 32&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the type set to "C" as well.&amp;nbsp; However, I want to keep the products to keep this descending order.&amp;nbsp; I am building a chart of products by year and want the products to keep the same order of appearance. However, when I apply this format I have created to a proc report, (applied to the product variable) it doesn't maintain the descending order. I am aware of assigning a value for HLO field, but&amp;nbsp; I haven't figured out how to use it yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, in similar fashion to how one can make a notsorted proc format, how can I do the same when creating a format from a sas data set using&amp;nbsp;cntlin?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANK YOUUUUUUU!!!!!!!!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 17:43:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409562#M19750</guid>
      <dc:creator>sasiscool</dc:creator>
      <dc:date>2017-11-01T17:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ordered format through cntlin</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409570#M19751</link>
      <description>&lt;P&gt;You can include both variables, the formatted/unformatted and specify the unformatted as ORDER to force the correct order. You can use NODISPLAY to ensure its not shown on the report.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, if you're applying a format, it should sort using the underlying data, not the formatted value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 18:01:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409570#M19751</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-01T18:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ordered format through cntlin</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409587#M19752</link>
      <description>&lt;P&gt;I am already aware of those tricks, but it still doesn't work. Another question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if the table is product by year and the table looks like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Year 1&amp;nbsp; &amp;nbsp; &amp;nbsp;Year2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Year3&lt;/P&gt;&lt;P&gt;Apple&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 45&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;80&lt;/P&gt;&lt;P&gt;cherry&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;90&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 44&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;82&lt;/P&gt;&lt;P&gt;cake&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 78&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 60&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;75&lt;/P&gt;&lt;P&gt;pen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;50&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If each of the years have a different descending order, since some products sell at different rates per year, and I want to force the row&amp;nbsp;order to&amp;nbsp;appear according to the descending order of the last year, how do I dot that with my sas dataset format&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:12:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409587#M19752</guid>
      <dc:creator>sasiscool</dc:creator>
      <dc:date>2017-11-01T19:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ordered format through cntlin</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409590#M19753</link>
      <description>&lt;P&gt;AFAIK there isn't a built in mechanism within PROC REPORT that will do this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Especially if you're using YEAR as an ACROSS variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead you can create a data set in the order you want and then use PROC REPORT to display it as desired.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409590#M19753</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-01T19:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ordered format through cntlin</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409592#M19754</link>
      <description>&lt;P&gt;So i can't just create a dataset with the most recent year descending, save it as a format with&amp;nbsp;cntlin. And apply that to the proc report?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have to create a dataset with each year? and don't create a format?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for responding&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409592#M19754</guid>
      <dc:creator>sasiscool</dc:creator>
      <dc:date>2017-11-01T19:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ordered format through cntlin</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409597#M19755</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/39872"&gt;@sasiscool&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;So i can't just create a dataset with the most recent year descending, save it as a format with&amp;nbsp;cntlin. And apply that to the proc report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can do this, but that wasn't clear to me when I first read your question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would need to add in an order though, ie Apple = 1, Cherry = 2. Your current example has start=label which doesn't really create a format you want. So, you could create that and apply it to your data using PROC REPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an idea - untested:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myformat;

set have;

label=put(_n_, z2.);;
start=start;
type = 'C';
fmtname = 'myFmt.';''

run;

proc format cntlin=myFormat;
run;

proc report data=myReportData nowd;
column ...... ;

define fruit  / f=$myFmt. order=formatted

run;;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:23:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409597#M19755</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-01T19:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an ordered format through cntlin</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409598#M19756</link>
      <description>&lt;P&gt;Time to show 1) some data and 2) the result for that data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/39872"&gt;@sasiscool&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;So i can't just create a dataset with the most recent year descending, save it as a format with&amp;nbsp;cntlin. And apply that to the proc report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have to create a dataset with each year? and don't create a format?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you for responding&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you are attempting to have a different sort order for a second variable for every year. If that is the case then you likely can't use Year as an across variable. If you absolutely must have a different order for every year than you really need to show what you expect that result to look like as you obviously cannot have a single row label involved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your first question about maintaining order&amp;nbsp;you might try using the PRELOADFMT option in define block for the variable involved, which will require the use of the Order=data or Exclusive option. The format may require building with the NOTSORTED option.&amp;nbsp;You also should show your proc report code as you may have been setting some option(s) that affect order of appearance that you haven't mentioned in this thread yet.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2017 19:26:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-an-ordered-format-through-cntlin/m-p/409598#M19756</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-11-01T19:26:58Z</dc:date>
    </item>
  </channel>
</rss>

