<?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 Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66675#M19054</link>
    <description>Patrick&lt;BR /&gt;
one big reason I go to SASGF is the access to people who make SAS what it is!&lt;BR /&gt;
In SASGF in April this year the man who makes the formats was presenting a glimpse of syntax a little similar to what Andrew0845 posted. Rick demonstrated using regular expression syntax in an informat to parse strings in the magic way of perl regular expressions. He has been working on it for a few years so it is good to hear that it will finally be delivered in SAS9.3 (some time soon, qtr3 2011, maybe &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
Hence my earlier posting suggesting that regular expressions might have been behind the origins of "([0-9])". &lt;BR /&gt;
However, &lt;BR /&gt;
1-&amp;lt;([0-9])3='00 Youth'&lt;BR /&gt;
13-&amp;lt;([0-9])0='00 Teen'&lt;BR /&gt;
20-&amp;lt;([0-9])0='00 Adult'&lt;BR /&gt;
70-high='000 Senior';&lt;BR /&gt;
looks more like a weak effort to achieve the ranges in the following test &lt;BR /&gt;
proc format ;&lt;BR /&gt;
picture agedesc (round)&lt;BR /&gt;
1-&amp;lt;13='00 Youth'&lt;BR /&gt;
13-&amp;lt;20='00 Teen'&lt;BR /&gt;
20-&amp;lt;70='00 Adult'&lt;BR /&gt;
70-high='000 Senior'; &lt;BR /&gt;
run ;&lt;BR /&gt;
%put %sysfunc( putn( 13, agedesc ))  %sysfunc( putn( 103, agedesc )); &lt;BR /&gt;
produces the logline &lt;BR /&gt;
13 Teen  103 Senior&lt;BR /&gt;
 &lt;BR /&gt;
Interestingly, as these ranges are simply consecutive, PROC FORMAT would assume the choice Andrew's predecessor was enforcing - where consecutive ranges coincide on a value, assume it belongs to the upper range.&lt;BR /&gt;
picture agede5c &lt;BR /&gt;
1-13='00 Youth'&lt;BR /&gt;
13-20='00 Teen'&lt;BR /&gt;
20-70='00 Adult'&lt;BR /&gt;
70-high='000 Senior'; &lt;BR /&gt;
achieves the same effect &lt;BR /&gt;
 &lt;BR /&gt;
data demo ;&lt;BR /&gt;
do age= 0 to 3, 11.5 to 14 by 3, 18 to 22 by .4, 68 to 72 by .6, 99 to 102 by .7;&lt;BR /&gt;
put age= age agedesc.  age agede5c. ;&lt;BR /&gt;
end;&lt;BR /&gt;
stop ;&lt;BR /&gt;
run;&lt;BR /&gt;
produced these log lines[pre]age=0          0         0&lt;BR /&gt;
age=1    1 Youth   1 Youth&lt;BR /&gt;
age=2    2 Youth   2 Youth&lt;BR /&gt;
age=3    3 Youth   3 Youth&lt;BR /&gt;
age=11.5   12 Youth  11 Youth&lt;BR /&gt;
age=18    18 Teen   18 Teen&lt;BR /&gt;
age=18.4    18 Teen   18 Teen&lt;BR /&gt;
age=18.8    19 Teen   18 Teen&lt;BR /&gt;
age=19.2    19 Teen   19 Teen&lt;BR /&gt;
age=19.6    20 Teen   19 Teen&lt;BR /&gt;
age=20    20 Teen   20 Teen&lt;BR /&gt;
age=20.4   20 Adult  20 Adult&lt;BR /&gt;
age=20.8   21 Adult  20 Adult&lt;BR /&gt;
age=21.2   21 Adult  21 Adult&lt;BR /&gt;
age=21.6   22 Adult  21 Adult&lt;BR /&gt;
age=22   22 Adult  22 Adult&lt;BR /&gt;
age=68   68 Adult  68 Adult&lt;BR /&gt;
age=68.6   69 Adult  68 Adult&lt;BR /&gt;
age=69.2   69 Adult  69 Adult&lt;BR /&gt;
age=69.8   70 Adult  69 Adult&lt;BR /&gt;
age=70.4  70 Senior 70 Senior&lt;BR /&gt;
age=71  71 Senior 71 Senior&lt;BR /&gt;
age=71.6  72 Senior 71 Senior&lt;BR /&gt;
age=99  99 Senior 99 Senior&lt;BR /&gt;
age=99.7 100 Senior 99 Senior&lt;BR /&gt;
age=100.4 100 Senior100 Senior&lt;BR /&gt;
age=101.1 101 Senior101 Senior&lt;BR /&gt;
age=101.8 102 Senior101 Senior[/pre] &lt;BR /&gt;
peterC</description>
    <pubDate>Mon, 23 May 2011 16:22:06 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2011-05-23T16:22:06Z</dc:date>
    <item>
      <title>proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66665#M19044</link>
      <description>What does ([0-9])3 mean in a proc format picture definition?</description>
      <pubDate>Tue, 17 May 2011 20:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66665#M19044</guid>
      <dc:creator>andrew0845</dc:creator>
      <dc:date>2011-05-17T20:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66666#M19045</link>
      <description>what is your proc format code? and some origin data?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 18 May 2011 02:42:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66666#M19045</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-18T02:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66667#M19046</link>
      <description>proc format;&lt;BR /&gt;
  picture agegrp&lt;BR /&gt;
    1-&amp;lt;([0-9])3='00 Youth'&lt;BR /&gt;
   13-&amp;lt;([0-9])0='00 Teen'&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
I don't understand what "([0-9])3" and "([0-9])0" mean. Thanks.&lt;BR /&gt;
 &lt;BR /&gt;
Andrew</description>
      <pubDate>Wed, 18 May 2011 20:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66667#M19046</guid>
      <dc:creator>andrew0845</dc:creator>
      <dc:date>2011-05-18T20:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66668#M19047</link>
      <description>&amp;gt; proc format;&lt;BR /&gt;
&amp;gt;   picture agegrp&lt;BR /&gt;
&amp;gt;   1-&amp;lt;([0-9])3='00 Youth'&lt;BR /&gt;
&amp;gt;  13-&amp;lt;([0-9])0='00 Teen'&lt;BR /&gt;
&amp;gt; un;&lt;BR /&gt;
&amp;gt;  &lt;BR /&gt;
&amp;gt; don't understand what "([0-9])3" and "([0-9])0"&lt;BR /&gt;
&amp;gt;  mean. Thanks.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Andrew&lt;BR /&gt;
 &lt;BR /&gt;
Looks like some form of regular expression........</description>
      <pubDate>Fri, 20 May 2011 13:38:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66668#M19047</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-05-20T13:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66669#M19048</link>
      <description>It's just because I cannot "cut and paste" the whole code. I don't know where the wrong is. Whenever, I cut and paste the posted message is just part of the original message I intended to post!&lt;BR /&gt;
&lt;BR /&gt;
The part posted is the part I don't understand. The other part, you can imagine, is just like a normal definition for a proc format picture.&lt;BR /&gt;
&lt;BR /&gt;
I don't undertand the following way to express a range for a value in a picture definition.&lt;BR /&gt;
&lt;BR /&gt;
I just show the uplimit of a range for a value: ([0-9])3, say. &lt;BR /&gt;
&lt;BR /&gt;
Does that mean 0*3, 1*3..., 9*3 or 3, 4,..., 93? What does that really mean?&lt;BR /&gt;
&lt;BR /&gt;
Would you please tell me how I can understand that? Thanks!</description>
      <pubDate>Fri, 20 May 2011 16:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66669#M19048</guid>
      <dc:creator>andrew0845</dc:creator>
      <dc:date>2011-05-20T16:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66670#M19049</link>
      <description>&amp;gt; The part posted is the part I don't understand. The&lt;BR /&gt;
&amp;gt; other part, you can imagine, is just like a normal&lt;BR /&gt;
&amp;gt; definition for a proc format picture.&lt;BR /&gt;
&lt;BR /&gt;
If we could see the code in context it might make sense.  Otherwise it is just a string of characters.</description>
      <pubDate>Fri, 20 May 2011 18:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66670#M19049</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-05-20T18:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66671#M19050</link>
      <description>Here's some info about how to include program code in your forum post: &lt;A href="http://support.sas.com/forums/thread.jspa?messageID=27609毙" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=27609毙&lt;/A&gt;</description>
      <pubDate>Fri, 20 May 2011 19:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66671#M19050</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2011-05-20T19:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66672#M19051</link>
      <description>The original code is as follows:&lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
picture agegrp&lt;BR /&gt;
1-&amp;lt;([0-9])3='00 Youth'&lt;BR /&gt;
13-&amp;lt;([0-9])0='00 Teen'&lt;BR /&gt;
20-&amp;lt;([0-9])0='00 Adult'&lt;BR /&gt;
70-high='000 Senior';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&amp;lt; is the symbol for "smaller than". That is the way I can input the original code, otherwise, the most of part will disappear mysteriously after it is posted.&lt;BR /&gt;
&lt;BR /&gt;
What does ([0-9])3 and ([0-9])0 mean in the picture definition?&lt;BR /&gt;
&lt;BR /&gt;
Besides, if I only use &amp;lt; not -&amp;lt;, what would happend? Inclusive for the lower limit or upper limit?&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Fri, 20 May 2011 20:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66672#M19051</guid>
      <dc:creator>andrew0845</dc:creator>
      <dc:date>2011-05-20T20:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66673#M19052</link>
      <description>Sorry.I do not have some clue.I have never see this code before. It looks like so weird.&lt;BR /&gt;
Maybe You need to google it or check some documentation.&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Mon, 23 May 2011 00:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66673#M19052</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-23T00:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66674#M19053</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
I don't think the code you've posted is valid SAS syntax.&lt;BR /&gt;
&lt;BR /&gt;
At least when I run the following I'm getting a syntax error.&lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;picture agegrp&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1-  &amp;lt;([0-9])3 ='00 Youth'&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;13- &amp;lt;([0-9])0 ='00 Teen'&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;20- &amp;lt;([0-9])0 ='00 Adult'&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;70- high      ='000 Senior'&lt;BR /&gt;
  ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Below code is valid SAS syntax and probabely gives you what you're after:&lt;BR /&gt;
&lt;BR /&gt;
proc format;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;picture agegrp&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;low-&amp;lt; 1  ='00 Baby'&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1-  &amp;lt; 13 ='00 Youth'&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;13- &amp;lt; 20 ='00 Teen'&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;20- &amp;lt; 70 ='00 Adult'&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;70- high ='000 Senior'&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
And: The SAS Forum pages have an issue with &amp;lt; and &amp;gt; These are characters used in HTML to mark the start and end of a HTML tag.&lt;BR /&gt;
To use &amp;lt; and &amp;gt;  in a post you have to write them in HTML syntax (HTML encoding). To do so you have to add a ';' after '&amp;lt;' and '&amp;gt;'.&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick

Message was edited by: Patrick</description>
      <pubDate>Mon, 23 May 2011 03:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66674#M19053</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-05-23T03:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: proc format;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66675#M19054</link>
      <description>Patrick&lt;BR /&gt;
one big reason I go to SASGF is the access to people who make SAS what it is!&lt;BR /&gt;
In SASGF in April this year the man who makes the formats was presenting a glimpse of syntax a little similar to what Andrew0845 posted. Rick demonstrated using regular expression syntax in an informat to parse strings in the magic way of perl regular expressions. He has been working on it for a few years so it is good to hear that it will finally be delivered in SAS9.3 (some time soon, qtr3 2011, maybe &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
Hence my earlier posting suggesting that regular expressions might have been behind the origins of "([0-9])". &lt;BR /&gt;
However, &lt;BR /&gt;
1-&amp;lt;([0-9])3='00 Youth'&lt;BR /&gt;
13-&amp;lt;([0-9])0='00 Teen'&lt;BR /&gt;
20-&amp;lt;([0-9])0='00 Adult'&lt;BR /&gt;
70-high='000 Senior';&lt;BR /&gt;
looks more like a weak effort to achieve the ranges in the following test &lt;BR /&gt;
proc format ;&lt;BR /&gt;
picture agedesc (round)&lt;BR /&gt;
1-&amp;lt;13='00 Youth'&lt;BR /&gt;
13-&amp;lt;20='00 Teen'&lt;BR /&gt;
20-&amp;lt;70='00 Adult'&lt;BR /&gt;
70-high='000 Senior'; &lt;BR /&gt;
run ;&lt;BR /&gt;
%put %sysfunc( putn( 13, agedesc ))  %sysfunc( putn( 103, agedesc )); &lt;BR /&gt;
produces the logline &lt;BR /&gt;
13 Teen  103 Senior&lt;BR /&gt;
 &lt;BR /&gt;
Interestingly, as these ranges are simply consecutive, PROC FORMAT would assume the choice Andrew's predecessor was enforcing - where consecutive ranges coincide on a value, assume it belongs to the upper range.&lt;BR /&gt;
picture agede5c &lt;BR /&gt;
1-13='00 Youth'&lt;BR /&gt;
13-20='00 Teen'&lt;BR /&gt;
20-70='00 Adult'&lt;BR /&gt;
70-high='000 Senior'; &lt;BR /&gt;
achieves the same effect &lt;BR /&gt;
 &lt;BR /&gt;
data demo ;&lt;BR /&gt;
do age= 0 to 3, 11.5 to 14 by 3, 18 to 22 by .4, 68 to 72 by .6, 99 to 102 by .7;&lt;BR /&gt;
put age= age agedesc.  age agede5c. ;&lt;BR /&gt;
end;&lt;BR /&gt;
stop ;&lt;BR /&gt;
run;&lt;BR /&gt;
produced these log lines[pre]age=0          0         0&lt;BR /&gt;
age=1    1 Youth   1 Youth&lt;BR /&gt;
age=2    2 Youth   2 Youth&lt;BR /&gt;
age=3    3 Youth   3 Youth&lt;BR /&gt;
age=11.5   12 Youth  11 Youth&lt;BR /&gt;
age=18    18 Teen   18 Teen&lt;BR /&gt;
age=18.4    18 Teen   18 Teen&lt;BR /&gt;
age=18.8    19 Teen   18 Teen&lt;BR /&gt;
age=19.2    19 Teen   19 Teen&lt;BR /&gt;
age=19.6    20 Teen   19 Teen&lt;BR /&gt;
age=20    20 Teen   20 Teen&lt;BR /&gt;
age=20.4   20 Adult  20 Adult&lt;BR /&gt;
age=20.8   21 Adult  20 Adult&lt;BR /&gt;
age=21.2   21 Adult  21 Adult&lt;BR /&gt;
age=21.6   22 Adult  21 Adult&lt;BR /&gt;
age=22   22 Adult  22 Adult&lt;BR /&gt;
age=68   68 Adult  68 Adult&lt;BR /&gt;
age=68.6   69 Adult  68 Adult&lt;BR /&gt;
age=69.2   69 Adult  69 Adult&lt;BR /&gt;
age=69.8   70 Adult  69 Adult&lt;BR /&gt;
age=70.4  70 Senior 70 Senior&lt;BR /&gt;
age=71  71 Senior 71 Senior&lt;BR /&gt;
age=71.6  72 Senior 71 Senior&lt;BR /&gt;
age=99  99 Senior 99 Senior&lt;BR /&gt;
age=99.7 100 Senior 99 Senior&lt;BR /&gt;
age=100.4 100 Senior100 Senior&lt;BR /&gt;
age=101.1 101 Senior101 Senior&lt;BR /&gt;
age=101.8 102 Senior101 Senior[/pre] &lt;BR /&gt;
peterC</description>
      <pubDate>Mon, 23 May 2011 16:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-format/m-p/66675#M19054</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-05-23T16:22:06Z</dc:date>
    </item>
  </channel>
</rss>

