<?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: Formats in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319290#M70078</link>
    <description>&lt;P&gt;I question the need for such a thing. You can subset data into any procedure using a data set option where clause even if the procedure does not support a separate where statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does your variable Proc_code have multiple values that get mapped to "1"? If not I suggest that the format is possibly obfuscating the meaning of the code (even more than calling a macro "count" that is actually subsetting data).&lt;/P&gt;</description>
    <pubDate>Thu, 15 Dec 2016 15:13:51 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-12-15T15:13:51Z</dc:date>
    <item>
      <title>Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319272#M70066</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the below Macro , I want to create several datasets by changing the format each time.&lt;/P&gt;&lt;P&gt;Is this the correct syntax? especially while the charecter format is used in the where statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;&lt;I&gt;counts&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;data &amp;amp;want;&lt;/P&gt;&lt;P&gt;set TX_2;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;where put(PROC_CODE,$&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;cat.&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"1"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;cat=&amp;amp;catname;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;counts&lt;/I&gt;&lt;/STRONG&gt;(want=pancreas cat=pancreas catname=pancreas);&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;counts&lt;/I&gt;&lt;/STRONG&gt;(want=lungs cat=lungs catname=lungs);&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 14:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319272#M70066</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2016-12-15T14:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319280#M70070</link>
      <description>&lt;P&gt;Your %macro definition statement has no parameters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro counts(want,cat,catname);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cat = "&amp;amp;catname";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or the data step will go looking for variables called pancreas or lungs.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 15:03:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319280#M70070</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-15T15:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319290#M70078</link>
      <description>&lt;P&gt;I question the need for such a thing. You can subset data into any procedure using a data set option where clause even if the procedure does not support a separate where statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does your variable Proc_code have multiple values that get mapped to "1"? If not I suggest that the format is possibly obfuscating the meaning of the code (even more than calling a macro "count" that is actually subsetting data).&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 15:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319290#M70078</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-15T15:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319333#M70111</link>
      <description>&lt;P&gt;Hello Ballard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 20 or so formats like these and some of them have 50 codes within each....&lt;/P&gt;&lt;P&gt;My final goal is to get the counts by each of those categories....&lt;/P&gt;&lt;P&gt;Is there any other efficient method to use?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;value&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; $ENDO&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'37220'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'37221'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'37222'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'37223'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;other=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;format&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;value&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; $OPEN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35556'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35566'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35571'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35583'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35585'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35587'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35656'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35666'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35671'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;other=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 17:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319333#M70111</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2016-12-15T17:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319398#M70142</link>
      <description>&lt;P&gt;If these are all being applied to the same Variable, such as&amp;nbsp;Proc_code, and the code values do not over lap&amp;nbsp;I would code the formats more as:&lt;/P&gt;
&lt;PRE&gt;proc format;
   value $Proc_code
   '37220','37221','37222','37223'                                             ='End'
   '35556','35566','35571','35583','35585','35587', '35656','35666', '35671'   ='Open'&lt;BR /&gt;   other = 'Code not assigned'
   ;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using a label that makes sense for each group.&lt;/P&gt;
&lt;P&gt;And then use the format in Proc Freq, Tabulate or Report:&lt;/P&gt;
&lt;P&gt;Proc freq data=TX_2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tables Proc_code;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format Proc_code $Proc_code.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a situation where there are sub-groups contained within one of the categories such as &lt;FONT color="#800080" face="Courier New" size="2"&gt;'35556'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35566'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35571'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35583'&lt;/FONT&gt;=&amp;nbsp;Open-Accounting and &lt;FONT color="#800080" face="Courier New" size="2"&gt;'35585'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35587'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35656'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'35666'&lt;/FONT&gt;=&amp;nbsp;Open-Sales&lt;/P&gt;
&lt;P&gt;then perhaps a multilabel format would be useful though you need to use a procedure that supports multilabel such as Tabulate or Report.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 21:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formats/m-p/319398#M70142</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-15T21:28:49Z</dc:date>
    </item>
  </channel>
</rss>

