<?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: proc format, numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840593#M332355</link>
    <description>I mean, I want cos in the output data set, generated by proc summary, to be numeric.</description>
    <pubDate>Tue, 25 Oct 2022 15:21:43 GMT</pubDate>
    <dc:creator>geneshackman</dc:creator>
    <dc:date>2022-10-25T15:21:43Z</dc:date>
    <item>
      <title>proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840588#M332352</link>
      <description>&lt;P&gt;I hope this is a simple question. I have a program that includes a proc format and a proc summary. When I run the proc summary, the values in the class statement column (cos) come out character but I want them to be numeric.&amp;nbsp; I want cos to be numeric. Can I do that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;** Here is the program **&lt;/P&gt;
&lt;P&gt;proc format ;&lt;BR /&gt;value cos (multilabel)&lt;BR /&gt;1-62 = 999&lt;BR /&gt;1-57 = 888&lt;BR /&gt;58-62 = 102&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc import&lt;BR /&gt;datafile= "T:\gxs03\Misc\exampledata.csv"&lt;BR /&gt;dbms=csv&lt;BR /&gt;out=example&lt;BR /&gt;replace;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc summary data=example nway ;&lt;BR /&gt;class cos / mlf ;&lt;BR /&gt;format cos cos.;&lt;BR /&gt;var count pop;&lt;BR /&gt;output out=exampleregion sum=;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;** Here are the data **&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;cos&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;count&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;pop&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;35000&lt;/TD&gt;
&lt;TD align="right"&gt;983&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;746&lt;/TD&gt;
&lt;TD align="right"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;58&lt;/TD&gt;
&lt;TD align="right"&gt;462158&lt;/TD&gt;
&lt;TD align="right"&gt;49773&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;9534&lt;/TD&gt;
&lt;TD align="right"&gt;319&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;59&lt;/TD&gt;
&lt;TD align="right"&gt;760449&lt;/TD&gt;
&lt;TD align="right"&gt;44365&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;** Here is the output**&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl63" style="height: 15.0pt; width: 48pt;"&gt;cos&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;_TYPE_&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;_FREQ_&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;count&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;pop&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;102&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;1222607&lt;/TD&gt;
&lt;TD align="right"&gt;94138&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;888&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;45280&lt;/TD&gt;
&lt;TD align="right"&gt;1307&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;999&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;5&lt;/TD&gt;
&lt;TD align="right"&gt;1267887&lt;/TD&gt;
&lt;TD align="right"&gt;95445&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&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;</description>
      <pubDate>Tue, 25 Oct 2022 15:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840588#M332352</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2022-10-25T15:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840590#M332353</link>
      <description>&lt;P&gt;Using MultiLabel formats in PROC SUMMARY force the variable in the OUTPUT data set to be character.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 15:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840590#M332353</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-25T15:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840593#M332355</link>
      <description>I mean, I want cos in the output data set, generated by proc summary, to be numeric.</description>
      <pubDate>Tue, 25 Oct 2022 15:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840593#M332355</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2022-10-25T15:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840594#M332356</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31988"&gt;@geneshackman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I mean, I want cos in the output data set, generated by proc summary, to be numeric.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can't be done with multi-label formats.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 15:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840594#M332356</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-25T15:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840595#M332357</link>
      <description>&lt;P&gt;PaigeMiller, thanks, that's good to know. But the problem is that cos divides the groups into three, and one overlaps with the other two.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cos is counties. 1-57 are New York State outside of New York City. 58-62 are New York City. And 1-62 is New York State, which overlaps with the other two.&lt;/P&gt;
&lt;P&gt;proc format ;&lt;BR /&gt;value cos (multilabel)&lt;BR /&gt;1-62 = 999&lt;BR /&gt;1-57 = 888&lt;BR /&gt;58-62 = 102&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I kind of have to use these three overlapping groups. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But good to know "multilable" makes them character.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 15:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840595#M332357</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2022-10-25T15:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840596#M332358</link>
      <description>&lt;P&gt;I don't understand the issue here. You have chosen to group the data 3 ways, and now it sounds like this is not what you want to do? Please explain in more detail.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 15:29:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840596#M332358</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-25T15:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840604#M332363</link>
      <description>Thanks. It is three groups, but one (New York State) overlaps with the other two. But I think I'll try some other ways now .....</description>
      <pubDate>Tue, 25 Oct 2022 15:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840604#M332363</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2022-10-25T15:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840605#M332364</link>
      <description>&lt;P&gt;Just change it to numeric by adding another step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  length cos 8;
  set exampleregion (rename=(cos=string));
  cos = input(string,32.);
  drop string;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 15:59:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840605#M332364</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-25T15:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840606#M332365</link>
      <description>Yes, thanks. I just wanted to see if i could do it without another data step. But I can do this too.</description>
      <pubDate>Tue, 25 Oct 2022 16:05:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840606#M332365</guid>
      <dc:creator>geneshackman</dc:creator>
      <dc:date>2022-10-25T16:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: proc format, numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840628#M332379</link>
      <description>&lt;P&gt;In this case, the value of the format is unique and just digits, so it can be converted to numeric with an extra step. In other cases, the value of the format is not just digits, and cannot be easily converted (if it can be converted at all) to numeric.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 17:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format-numeric/m-p/840628#M332379</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-25T17:45:33Z</dc:date>
    </item>
  </channel>
</rss>

