<?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: format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929907#M365867</link>
    <description>&lt;P&gt;95&amp;lt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;-&lt;/STRONG&gt;&lt;/FONT&gt;100&lt;BR /&gt;Add the dash!&lt;/P&gt;
&lt;P&gt;Below your format fixed BUT it will likely not return what you're after. Just try with a few values like 100. The format definition will likely some amendment to return the desired label for a specific value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value Fmt
    -999      ='(a) A=0 AND B not 0'
    -888      ='(b) A=0 AND B=0'
    -777      ='(c)  B=0 AND A not 0'
    0         ='(d) A&amp;gt;0 AND B=0'
    0&amp;lt;-25     ='(e1) Ratio till 25%'
    25&amp;lt;-50    ='(e2) 25%&amp;lt;Ratio&amp;lt;=50%'
    50&amp;lt;-75    ='(e3) 50%&amp;lt;Ratio&amp;lt;=75%'
    75&amp;lt;-85    ='(e4) 75%&amp;lt;Ratio&amp;lt;=85%'
    85&amp;lt;-95    ='(e5) 85%&amp;lt;Ratio&amp;lt;=95%'
    95&amp;lt;-100   ='(e6) 95%&amp;lt;Ratio&amp;lt;100%'
    100       ='(e7) Ratio=100%'
    100&amp;lt;-105  ='(f1) 100%&amp;lt;Ratio&amp;lt;=105%'
    105&amp;lt;-115  ='(f2) 105%&amp;lt;Ratio&amp;lt;=115%'
    115&amp;lt;-125  ='(f3) 115%&amp;lt;Ratio&amp;lt;=125%'
    125&amp;lt;-150  ='(f4) 125%&amp;lt;Ratio&amp;lt;=150%'
    150&amp;lt;-HIGH ='(f5) 150%+'
    other     ='(g) Negative Ratio'
  ;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Given your label I assume what you really want is for values around 100 (haven't checked the rest):&lt;/P&gt;
&lt;PRE&gt;    95&amp;lt;-&amp;lt;100   ='(e6) 95%&amp;lt;Ratio&amp;lt;100%'
    100       ='(e7) Ratio=100%'
    100&amp;lt;-105  ='(f1) 100%&amp;lt;Ratio&amp;lt;=105%'&lt;/PRE&gt;</description>
    <pubDate>Tue, 28 May 2024 06:10:52 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2024-05-28T06:10:52Z</dc:date>
    <item>
      <title>Syntax error in proc format with value statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929901#M365861</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;There is an error in this code that create format.&lt;/P&gt;
&lt;P&gt;What is the way to solve it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value Fmt
-999='(a) A=0 AND B not 0'
-888='(b) A=0 AND B=0'
-777='(c)  B=0 AND A not 0'
0='(d) A&amp;gt;0 AND B=0'
0&amp;lt;-25='(e1) Ratio till 25%'
25&amp;lt;-50='(e2) 25%&amp;lt;Ratio&amp;lt;=50%'
50&amp;lt;-75='(e3) 50%&amp;lt;Ratio&amp;lt;=75%'
75&amp;lt;-85='(e4) 75%&amp;lt;Ratio&amp;lt;=85%'
85&amp;lt;-95='(e5) 85%&amp;lt;Ratio&amp;lt;=95%'
95&amp;lt;100='(e6) 95%&amp;lt;Ratio&amp;lt;100%'
100='(e7) Ratio=100%'
100&amp;lt;-105='(f1) 100%&amp;lt;Ratio&amp;lt;=105%'
105&amp;lt;-115='(f2) 105%&amp;lt;Ratio&amp;lt;=115%'
115&amp;lt;-125='(f3) 115%&amp;lt;Ratio&amp;lt;=125%'
125&amp;lt;-150='(f4) 125%&amp;lt;Ratio&amp;lt;=150%'
150&amp;lt;-HIGH='(f5) 150%+'
other='(g) Negative Ratio'
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;error&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1                                                          The SAS System                                 10:31 Monday, May 27, 2024

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program (2)';
4          %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5          %LET _CLIENTPROJECTPATH='';
6          %LET _CLIENTPROJECTPATHHOST='';
7          %LET _CLIENTPROJECTNAME='';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=PNG;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         FILENAME EGSR TEMP;
15         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16             STYLE=HTMLBlue
17             STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HTMLBlue.css")
18             NOGTITLE
19             NOGFOOTNOTE
20             GPATH=&amp;amp;sasworklocation
21             ENCODING=UTF8
22             options(rolap="on")
23         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24         
25         GOPTIONS ACCESSIBLE;


26         proc format;
27         value Fmt
28         -999='(a) A=0 AND B not 0'
29         -888='(b) A=0 AND B=0'
30         -777='(c)  B=0 AND A not 0'
31         0='(d) A&amp;gt;0 AND B=0'
32         0&amp;lt;-25='(e1) Ratio till 25%'
33         25&amp;lt;-50='(e2) 25%&amp;lt;Ratio&amp;lt;=50%'
34         50&amp;lt;-75='(e3) 50%&amp;lt;Ratio&amp;lt;=75%'
35         75&amp;lt;-85='(e4) 75%&amp;lt;Ratio&amp;lt;=85%'
36         85&amp;lt;-95='(e5) 85%&amp;lt;Ratio&amp;lt;=95%'
37         95&amp;lt;100='(e6) 95%&amp;lt;Ratio&amp;lt;100%'
              ___
              22
              76
ERROR 22-322: Syntax error, expecting one of the following: ',', -.  

ERROR 76-322: Syntax error, statement will be ignored.

38         100='(e7) Ratio=100%'
39         100&amp;lt;-105='(f1) 100%&amp;lt;Ratio&amp;lt;=105%'
40         105&amp;lt;-115='(f2) 105%&amp;lt;Ratio&amp;lt;=115%'
41         115&amp;lt;-125='(f3) 115%&amp;lt;Ratio&amp;lt;=125%'
42         125&amp;lt;-150='(f4) 125%&amp;lt;Ratio&amp;lt;=150%'
43         150&amp;lt;-HIGH='(f5) 150%+'
44         other='(g) Negative Ratio'
45         ;
NOTE: The previous statement has been deleted.
46         Run;

2                                                          The SAS System                                 10:31 Monday, May 27, 2024

NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.00 seconds
      user cpu time       0.01 seconds
      system cpu time     0.00 seconds
      memory              73.81k
      OS Memory           27300.00k
      Timestamp           05/28/2024 07:26:06 AM
      Step Count                        157  Switch Count  0
      Page Faults                       0
      Page Reclaims                     7
      Page Swaps                        0
      Voluntary Context Switches        3
      Involuntary Context Switches      1
      Block Input Operations            0
      Block Output Operations           0
      
NOTE: The SAS System stopped processing this step because of errors.
47         
48         GOPTIONS NOACCESSIBLE;
49         %LET _CLIENTTASKLABEL=;
50         %LET _CLIENTPROCESSFLOWNAME=;
51         %LET _CLIENTPROJECTPATH=;
52         %LET _CLIENTPROJECTPATHHOST=;
53         %LET _CLIENTPROJECTNAME=;
54         %LET _SASPROGRAMFILE=;
55         %LET _SASPROGRAMFILEHOST=;
56         
57         ;*';*";*/;quit;run;
58         ODS _ALL_ CLOSE;
59         
60         
61         QUIT; RUN;
62         
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 May 2024 12:06:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929901#M365861</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-05-28T12:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929904#M365864</link>
      <description>It’s just missing a dash as used in your other lines.&lt;BR /&gt;If you want to include 100 don’t use the angle bracket.</description>
      <pubDate>Tue, 28 May 2024 05:46:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929904#M365864</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-28T05:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929906#M365866</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;95&amp;lt;100='(e6) 95%&amp;lt;Ratio&amp;lt;100%'
100='(e7) Ratio=100%'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want that 100 will be a separate group&lt;/P&gt;
&lt;P&gt;I want that group 95&amp;lt;100 will be between 95(not included) and 100 (not included)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 05:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929906#M365866</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-05-28T05:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929907#M365867</link>
      <description>&lt;P&gt;95&amp;lt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;-&lt;/STRONG&gt;&lt;/FONT&gt;100&lt;BR /&gt;Add the dash!&lt;/P&gt;
&lt;P&gt;Below your format fixed BUT it will likely not return what you're after. Just try with a few values like 100. The format definition will likely some amendment to return the desired label for a specific value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value Fmt
    -999      ='(a) A=0 AND B not 0'
    -888      ='(b) A=0 AND B=0'
    -777      ='(c)  B=0 AND A not 0'
    0         ='(d) A&amp;gt;0 AND B=0'
    0&amp;lt;-25     ='(e1) Ratio till 25%'
    25&amp;lt;-50    ='(e2) 25%&amp;lt;Ratio&amp;lt;=50%'
    50&amp;lt;-75    ='(e3) 50%&amp;lt;Ratio&amp;lt;=75%'
    75&amp;lt;-85    ='(e4) 75%&amp;lt;Ratio&amp;lt;=85%'
    85&amp;lt;-95    ='(e5) 85%&amp;lt;Ratio&amp;lt;=95%'
    95&amp;lt;-100   ='(e6) 95%&amp;lt;Ratio&amp;lt;100%'
    100       ='(e7) Ratio=100%'
    100&amp;lt;-105  ='(f1) 100%&amp;lt;Ratio&amp;lt;=105%'
    105&amp;lt;-115  ='(f2) 105%&amp;lt;Ratio&amp;lt;=115%'
    115&amp;lt;-125  ='(f3) 115%&amp;lt;Ratio&amp;lt;=125%'
    125&amp;lt;-150  ='(f4) 125%&amp;lt;Ratio&amp;lt;=150%'
    150&amp;lt;-HIGH ='(f5) 150%+'
    other     ='(g) Negative Ratio'
  ;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Given your label I assume what you really want is for values around 100 (haven't checked the rest):&lt;/P&gt;
&lt;PRE&gt;    95&amp;lt;-&amp;lt;100   ='(e6) 95%&amp;lt;Ratio&amp;lt;100%'
    100       ='(e7) Ratio=100%'
    100&amp;lt;-105  ='(f1) 100%&amp;lt;Ratio&amp;lt;=105%'&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 May 2024 06:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929907#M365867</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-28T06:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929929#M365878</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;However I don't understand something.&lt;/P&gt;
&lt;P&gt;There are 2 groups that 100 is included in their definition&lt;/P&gt;
&lt;P&gt;In the group defined by&amp;nbsp;95&amp;lt;-100 I see dash next to 100.Does it mean that 100 is included?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;95&amp;lt;-100='(e6) 95%&amp;lt;Ratio&amp;lt;100%'
100='(e7) Ratio=100%'&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 May 2024 06:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929929#M365878</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-05-28T06:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929930#M365879</link>
      <description>&lt;P&gt;Hint:&lt;/P&gt;
&lt;P&gt;Angular brackets are used to exclude the end values from the range. They can appear on &lt;U&gt;both&lt;/U&gt; sides of the dash.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 06:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929930#M365879</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-05-28T06:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929939#M365883</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;I believe what you're really after is what I shared already.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    95&amp;lt;-&amp;lt;100   ='(e6) 95%&amp;lt;Ratio&amp;lt;100%'
    100       ='(e7) Ratio=100%'
    100&amp;lt;-105  ='(f1) 100%&amp;lt;Ratio&amp;lt;=105%&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If not 100% if things work as desired then it's also always a good idea to mock-up some sample data for testing. Like 3 rows with values 99, 100, 101 and then test how the formatted values look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2024 07:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-in-proc-format-with-value-statement/m-p/929939#M365883</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-05-28T07:33:36Z</dc:date>
    </item>
  </channel>
</rss>

