<?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: Perl in macro question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217527#M40069</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The following is from the documentation's explanation of the ?? modifier:&amp;nbsp; &lt;SPAN style="font-weight: bold; font-size: 10pt; line-height: 1.5em;"&gt;? or ?? &lt;/SPAN&gt;&lt;A name="a000843689" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the optional question mark (?) and double question mark (??) modifiers that suppress the printing of both the error messages and the input lines when invalid data values are read. The ? modifier suppresses the invalid data message. The ?? modifier also suppresses the invalid data message and, in addition, prevents the automatic variable _ERROR_ from being set to 1 when invalid data are read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While I've tried to find the time to learn regular expressions, I still haven't. Thus, I'm sure the following is more convoluted than it has to be. However, if I correctly understand what you want to do, then the following appears to accomplish the task:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data seed;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length start $100;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain fmtname 'wordnum' type 'i';&lt;/P&gt;&lt;P&gt;&amp;nbsp; do label=1 to 100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=upcase(put(label,words100.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format library=work cntlin=seed; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl WITH THREE mnop qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl WITH THREE mxop qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl WITH THIRTY mnop qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl W/ TWENTY-FIVE qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl W TWENTY-FIVE qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl With/ TWENTY-FIVE qrst"; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (drop=newvar re);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length newvar $200;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var=upcase(var);&lt;/P&gt;&lt;P&gt;&amp;nbsp; _n_=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do while (scan(var,_n_,' ') ne '');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if input(scan(var,_n_,' '),?? wordnum.) gt 0 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var2=input(scan(var,_n_,' '),wordnum.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newvar=catx(' ',newvar,input(scan(var,_n_,' '),wordnum.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else newvar=catx(' ',newvar,scan(var,_n_,' '));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _n_+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; re=prxparse('/(WITH\s|W\/\s)\d{1,3}(\sMNOP|\sQRST)/');&lt;/P&gt;&lt;P&gt;&amp;nbsp; if not prxmatch(re,newvar) then call missing(var2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Apr 2015 17:35:37 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2015-04-08T17:35:37Z</dc:date>
    <item>
      <title>Perl in macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217523#M40065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a macro variable &lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;numlist as the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN|ELEVEN|TWELVE|THIRTEEN|FOURTEEN|FIFTEEN|SIXTEEN|SEVENTEEN|EIGHTEEN|NINETEEN|TWENTY|&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;TWENTY-ONE|TWENTY-TWO|TWENTY-THREE|and so on.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;And format of $&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;wordnum converts one to 1, two to 2, and so on.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I need to use regular expression&amp;nbsp; to capture the word numbers like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;var=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;"abcd efgh ijkl WITH THREE mnop qrst"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;var=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;"abcd efgh ijkl W/ TWENTY-FIVE qrst"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;STRONG&gt;&lt;EM&gt;try&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; data want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;%local&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; re1; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; re1=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;(prxparse(/(\s|\(|\)|-|#|[HW]\/ ?)(\d{1,3}|&amp;amp;numlist)\W*(mnop|qrst)/));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;re1 &amp;gt; &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;%then&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; pt_comments=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;(prxposn(&amp;amp;re1,2,var));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var2 = put(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;"&amp;amp;pt_comments"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$wordnum.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="line-height: 1.5em; color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;try&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=want; &lt;/SPAN&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;I’m expecting result of the following: var2 as 3 and 25, what did I do wrong in my program to create want? Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;obs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var2&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="border: solid #c1c1c1 1.0pt;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: none;" valign="bottom"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: none;" valign="bottom"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;abcd efgh ijkl WITH THREE mnop qrst&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: none;" valign="bottom"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt; 3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD nowrap="nowrap" style="border: none;" valign="bottom"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: none;" valign="bottom"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;abcd efgh ijkl W/ TWENTY-FIVE qrst&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border: none;" valign="bottom"&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt; 25&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 21:02:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217523#M40065</guid>
      <dc:creator>allaboutsas</dc:creator>
      <dc:date>2015-04-07T21:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Perl in macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217524#M40066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the program to create the macro variable and the format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; seed;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; start $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; num $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;10000&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;retain&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; fmtname &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'wordnum'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; type &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'c'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; num &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;''&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; label=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=upcase(put(label,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;words100.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num = catx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'|'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;, num, upcase(put(label,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;words100.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; symputx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'numlist'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;, num); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;format&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;library&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=work &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cntlin&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=seed; &lt;/SPAN&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 21:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217524#M40066</guid>
      <dc:creator>allaboutsas</dc:creator>
      <dc:date>2015-04-07T21:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Perl in macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217525#M40067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also do it without either a regular expression or a macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data seed;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length start $100;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain fmtname 'wordnum' type 'i';&lt;/P&gt;&lt;P&gt;&amp;nbsp; do label=1 to 100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=upcase(put(label,words100.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format library=work cntlin=seed; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl WITH THREE mnop qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl WITH JUNK mnop qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl W/ TWENTY-FIVE qrst"; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _n_=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do while (scan(var,_n_,' ') ne '');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if input(scan(var,_n_,' '),?? wordnum.) gt 0 then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var2=input(scan(var,_n_,' '),wordnum.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _n_+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2015 21:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217525#M40067</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-04-07T21:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Perl in macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217526#M40068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Thank you. The thing is there are more conditions need to be considered, like the number has to have WITH OR W/ in front of it and mnop behind it, etc, I can’t list all of them. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Can you explain what does ?? do in the first input statement?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2015 15:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217526#M40068</guid>
      <dc:creator>allaboutsas</dc:creator>
      <dc:date>2015-04-08T15:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Perl in macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217527#M40069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The following is from the documentation's explanation of the ?? modifier:&amp;nbsp; &lt;SPAN style="font-weight: bold; font-size: 10pt; line-height: 1.5em;"&gt;? or ?? &lt;/SPAN&gt;&lt;A name="a000843689" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the optional question mark (?) and double question mark (??) modifiers that suppress the printing of both the error messages and the input lines when invalid data values are read. The ? modifier suppresses the invalid data message. The ?? modifier also suppresses the invalid data message and, in addition, prevents the automatic variable _ERROR_ from being set to 1 when invalid data are read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While I've tried to find the time to learn regular expressions, I still haven't. Thus, I'm sure the following is more convoluted than it has to be. However, if I correctly understand what you want to do, then the following appears to accomplish the task:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data seed;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length start $100;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain fmtname 'wordnum' type 'i';&lt;/P&gt;&lt;P&gt;&amp;nbsp; do label=1 to 100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=upcase(put(label,words100.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format library=work cntlin=seed; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl WITH THREE mnop qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl WITH THREE mxop qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl WITH THIRTY mnop qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl W/ TWENTY-FIVE qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl W TWENTY-FIVE qrst"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="abcd efgh ijkl With/ TWENTY-FIVE qrst"; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (drop=newvar re);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length newvar $200;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var=upcase(var);&lt;/P&gt;&lt;P&gt;&amp;nbsp; _n_=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do while (scan(var,_n_,' ') ne '');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if input(scan(var,_n_,' '),?? wordnum.) gt 0 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var2=input(scan(var,_n_,' '),wordnum.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newvar=catx(' ',newvar,input(scan(var,_n_,' '),wordnum.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else newvar=catx(' ',newvar,scan(var,_n_,' '));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _n_+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; re=prxparse('/(WITH\s|W\/\s)\d{1,3}(\sMNOP|\sQRST)/');&lt;/P&gt;&lt;P&gt;&amp;nbsp; if not prxmatch(re,newvar) then call missing(var2);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2015 17:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217527#M40069</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-04-08T17:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Perl in macro question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217528#M40070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much! Arthur.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2015 18:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Perl-in-macro-question/m-p/217528#M40070</guid>
      <dc:creator>allaboutsas</dc:creator>
      <dc:date>2015-04-08T18:03:34Z</dc:date>
    </item>
  </channel>
</rss>

