<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/800458#M314893</link>
    <description>&lt;P&gt;Three problems:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Since SCOREFMT is a character variable, you have to create a character format, which would have a name that begins with a $. You created a numeric format which won't work.&lt;/LI&gt;
&lt;LI&gt;There is no DATA= in PROC FORMAT&lt;/LI&gt;
&lt;LI&gt;You have to associate the character format $scorefmt with the variable SCOREFMT, this is done via a FORMAT statement in a PROC or in a DATA step.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $scorefmt
'low-539' ="apple"
'540-559'="540&amp;lt;=SCORE&amp;lt;560"
'560-579'="560&amp;lt;=SCORE&amp;lt;580";
run;

proc print data=pf_lemon;
format scorefmt $scorefmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;</description>
    <pubDate>Sun, 06 Mar 2022 11:56:50 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-03-06T11:56:50Z</dc:date>
    <item>
      <title>proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/800454#M314890</link>
      <description>&lt;P&gt;I read the doc but dont understand as the example is not complete. I try the code attached,&lt;/P&gt;&lt;PRE&gt;data pf_lemon;
input scorefmt $;
datalines;
low-539
540-559
560-579   
run;

proc format data=pf_lemon;
value scorefmt
low-539 ="apple"
540-559="540&amp;lt;=SCORE&amp;lt;560"
560-579="560&amp;lt;=SCORE&amp;lt;580";
run;

proc print data=pf_lemon;
run;&lt;/PRE&gt;&lt;P&gt;how can I make it work?&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 11:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/800454#M314890</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-06T11:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/800458#M314893</link>
      <description>&lt;P&gt;Three problems:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Since SCOREFMT is a character variable, you have to create a character format, which would have a name that begins with a $. You created a numeric format which won't work.&lt;/LI&gt;
&lt;LI&gt;There is no DATA= in PROC FORMAT&lt;/LI&gt;
&lt;LI&gt;You have to associate the character format $scorefmt with the variable SCOREFMT, this is done via a FORMAT statement in a PROC or in a DATA step.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $scorefmt
'low-539' ="apple"
'540-559'="540&amp;lt;=SCORE&amp;lt;560"
'560-579'="560&amp;lt;=SCORE&amp;lt;580";
run;

proc print data=pf_lemon;
format scorefmt $scorefmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 11:56:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/800458#M314893</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-06T11:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/800511#M314936</link>
      <description>&lt;P&gt;Please post a link to the "example" source. If that is an example of what some site is using then it is either a very bad site, due to the number of errors that "example" generate, or you are skipping a lot of the actual example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what do you mean by "make it work"??? We have no idea what you would expect the result to be if or when it does "work".&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/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I read the doc but dont understand as the example is not complete. I try the code attached,&lt;/P&gt;
&lt;PRE&gt;data pf_lemon;
input scorefmt $;
datalines;
low-539
540-559
560-579   
run;

proc format data=pf_lemon;
value scorefmt
low-539 ="apple"
540-559="540&amp;lt;=SCORE&amp;lt;560"
560-579="560&amp;lt;=SCORE&amp;lt;580";
run;

proc print data=pf_lemon;
run;&lt;/PRE&gt;
&lt;P&gt;how can I make it work?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 23:08:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/800511#M314936</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-03-06T23:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/801585#M315468</link>
      <description>&lt;P&gt;thank you for your guidance&lt;/P&gt;
&lt;P&gt;I tried as you suggested, it works generallly except for the line with score low-539, pls see result below&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="HeatherNewton_0-1646969096045.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69394i5921B5AB52CF0BD9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HeatherNewton_0-1646969096045.png" alt="HeatherNewton_0-1646969096045.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;  input up down scorefmt $ sub_product  $;
datalines;
2 5 low-539 apple
3 2 540-559 lemon 
4 0 560-579 melon
run;

proc format;
value $scorefmt
low-539="SCORE&amp;lt;540"
540-559="540&amp;lt;=SCORE&amp;lt;560"
560-579="560&amp;lt;=score&amp;lt;580";
RUN;

proc print data=lemon;
format scorefmt $scorefmt.;
run;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Mar 2022 03:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/801585#M315468</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2022-03-11T03:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: proc format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/801594#M315476</link>
      <description>&lt;P&gt;Your format is designed to combine single&amp;nbsp;&lt;EM&gt;numeric&lt;/EM&gt; values into ranges, so you should feed it such.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pf_lemon;
input score;
datalines;
520
550
565
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=pf_lemon;
var score;
format score scorefmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Such range formats become very valuable when used with statistic procedures (FREQ, MEANS, TABULATE), as these will use the formatted values for grouping.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 05:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-format/m-p/801594#M315476</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-11T05:46:34Z</dc:date>
    </item>
  </channel>
</rss>

