<?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 Questions about Proc Formats in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Questions-about-Proc-Formats/m-p/315251#M68723</link>
    <description>&lt;P&gt;Hi there, I am reading the advanced exam prep guide and I got a few questions about proc formats. Hopefully some of you experts can help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Question 1&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $route 'Route1' = 'Zone 1'
			 'Route2' - 'Route4' = 'Zone 2'
			 'Route5' - 'Route9' = 'Zone 3';
run;

data route;
format route $route.;
do i = 1 to 9;
route = 'Route' || compress(put(i, 2.0));
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code is similar to what the prep guide has. It defines the formats mapping routes to different zones.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, route2 to route4 are mapped to zone 2. Now, I'm gonna make some changes to the format and map route2 to route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;/FONT&gt; to zone 2:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $route 'Route1' = 'Zone 1'
			 'Route2' - 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;/FONT&gt;' = 'Zone 2'
			 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;7&lt;/STRONG&gt;&lt;/FONT&gt;' - 'Route9' = 'Zone 3';
run;

data route;
format route $route.;
do i = 1 to 9;
route = 'Route' || compress(put(i, 2.0));
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I still get the previous result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6100i50C04EF54FB53893/image-size/medium?v=v2&amp;amp;px=-1" border="0" alt="i2.png" title="i2.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The format wasn't updated in SAS Studio. Is this a bug in SS? I tried the exact same code on SAS 9.4 and it worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Question 2&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For zone 2, I changed the route as route2 to route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;12&lt;/STRONG&gt;&lt;/FONT&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $route 'Route1' = 'Zone 1'
			 'Route2' - 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;12&lt;/STRONG&gt;&lt;/FONT&gt;' = 'Zone 2'
			 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;13&lt;/STRONG&gt;&lt;/FONT&gt;' - 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;20&lt;/STRONG&gt;&lt;/FONT&gt;' = 'Zone 3';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I got this error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: Start is greater than end: -.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could someone explain why? Does the range have to be within single digit?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2016 16:54:00 GMT</pubDate>
    <dc:creator>kisumsam</dc:creator>
    <dc:date>2016-11-29T16:54:00Z</dc:date>
    <item>
      <title>Questions about Proc Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Questions-about-Proc-Formats/m-p/315251#M68723</link>
      <description>&lt;P&gt;Hi there, I am reading the advanced exam prep guide and I got a few questions about proc formats. Hopefully some of you experts can help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Question 1&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $route 'Route1' = 'Zone 1'
			 'Route2' - 'Route4' = 'Zone 2'
			 'Route5' - 'Route9' = 'Zone 3';
run;

data route;
format route $route.;
do i = 1 to 9;
route = 'Route' || compress(put(i, 2.0));
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code is similar to what the prep guide has. It defines the formats mapping routes to different zones.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, route2 to route4 are mapped to zone 2. Now, I'm gonna make some changes to the format and map route2 to route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;/FONT&gt; to zone 2:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $route 'Route1' = 'Zone 1'
			 'Route2' - 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;/FONT&gt;' = 'Zone 2'
			 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;7&lt;/STRONG&gt;&lt;/FONT&gt;' - 'Route9' = 'Zone 3';
run;

data route;
format route $route.;
do i = 1 to 9;
route = 'Route' || compress(put(i, 2.0));
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I still get the previous result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6100i50C04EF54FB53893/image-size/medium?v=v2&amp;amp;px=-1" border="0" alt="i2.png" title="i2.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The format wasn't updated in SAS Studio. Is this a bug in SS? I tried the exact same code on SAS 9.4 and it worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Question 2&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For zone 2, I changed the route as route2 to route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;12&lt;/STRONG&gt;&lt;/FONT&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $route 'Route1' = 'Zone 1'
			 'Route2' - 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;12&lt;/STRONG&gt;&lt;/FONT&gt;' = 'Zone 2'
			 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;13&lt;/STRONG&gt;&lt;/FONT&gt;' - 'Route&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;20&lt;/STRONG&gt;&lt;/FONT&gt;' = 'Zone 3';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I got this error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: Start is greater than end: -.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could someone explain why? Does the range have to be within single digit?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 16:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Questions-about-Proc-Formats/m-p/315251#M68723</guid>
      <dc:creator>kisumsam</dc:creator>
      <dc:date>2016-11-29T16:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Questions about Proc Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Questions-about-Proc-Formats/m-p/315270#M68728</link>
      <description>&lt;P&gt;For question 2 ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As character strings, "Route12" is less than "Route2".&amp;nbsp; The first five characters are identical, so the sixth character determines which is greater.&amp;nbsp; For this application, you could overcome this error by changing the second range:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Route2'-'Route9', 'Route10'-'Route12' = 'Zone 2'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In other applications, it may not be so easy.&amp;nbsp; If you can control the data, it might help to use two-digit values, such as "Route01" instead of "Route1".&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 17:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Questions-about-Proc-Formats/m-p/315270#M68728</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-11-29T17:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Questions about Proc Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Questions-about-Proc-Formats/m-p/315273#M68730</link>
      <description>&lt;P&gt;Thanks Astounding. That makes sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 17:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Questions-about-Proc-Formats/m-p/315273#M68730</guid>
      <dc:creator>kisumsam</dc:creator>
      <dc:date>2016-11-29T17:22:19Z</dc:date>
    </item>
  </channel>
</rss>

