<?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: Access formula to SAS in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135504#M36658</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent...it worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Jan 2015 21:33:23 GMT</pubDate>
    <dc:creator>jbear</dc:creator>
    <dc:date>2015-01-30T21:33:23Z</dc:date>
    <item>
      <title>Access formula to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135499#M36653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need some assistance in translating this MS Access formula to SAS code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Format(IIf([contract_num] Is Not Null And [contract_num] Not Like '*[!0-9]*',Left(Replace(Replace(Replace(Trim([contract_num]),"/",""),"-","")," ",""),10),Left(Replace(Replace(Replace(Trim([loan_num]),"/",""),"-","")," ",""),10)),"0000000000")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My SAS code is missing some cases in the false argument of the IIf statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example case missed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="69" style="width: 347px; height: 82px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl77" height="17" width="117"&gt;contract_num&lt;/TD&gt;&lt;TD class="xl77" style="border-left: medium none;" width="64"&gt;alt_num&lt;/TD&gt;&lt;TD class="xl77" style="border-left: medium none;" width="77"&gt;new_num (outcome wanted)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl77" height="17" style="border-top: medium none;"&gt;6733708564/67821&lt;/TD&gt;&lt;TD class="xl77" style="border-left: medium none; border-top: medium none;"&gt;2&lt;/TD&gt;&lt;TD class="xl77" style="border-left: medium none; border-top: medium none;"&gt;0000000002&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current SAS code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: green; font-size: 10pt; font-family: 'Courier New';"&gt;/**/&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Segoe UI','sans-serif'; color: black; font-size: 10pt;"&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="; color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt; want;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Segoe UI','sans-serif'; color: black; font-size: 10pt;"&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-size: 10pt; font-family: 'Courier New';"&gt;set&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt; have;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Segoe UI','sans-serif'; color: black; font-size: 10pt;"&gt; &lt;BR /&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&gt;&lt;SPAN style="color: blue; font-size: 10pt; font-family: 'Courier New';"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-size: 10pt; font-family: 'Courier New';"&gt;not&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt; missing(contract_num) &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-size: 10pt; font-family: 'Courier New';"&gt;and&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt; countc(contract_num,&lt;/SPAN&gt;&lt;SPAN style="color: purple; font-size: 10pt; font-family: 'Courier New';"&gt;'0123456789'&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;) &amp;gt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN style="font-family: 'Segoe UI','sans-serif'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;0&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-size: 10pt; font-family: 'Courier New';"&gt;then&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp; new_num = substrn(compress(trim(contract_num),&lt;/SPAN&gt;&lt;SPAN style="color: purple; font-size: 10pt; font-family: 'Courier New';"&gt;"/-"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;),&lt;/SPAN&gt;&lt;SPAN style="; color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;SPAN style="; color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;);&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Segoe UI','sans-serif'; color: black; font-size: 10pt;"&gt; &lt;BR /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-size: 10pt; font-family: 'Courier New';"&gt;else&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt; new_num &lt;SPAN style="color: green; font-size: 10pt; font-family: 'Courier New';"&gt;/*10 character length*/&lt;/SPAN&gt; = substrn(compress(trim(alt_num),&lt;/SPAN&gt;&lt;SPAN style="color: purple; font-size: 10pt; font-family: 'Courier New';"&gt;"/-"&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;),&lt;/SPAN&gt;&lt;SPAN style="; color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;SPAN style="; color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;);&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Segoe UI','sans-serif'; color: black; font-size: 10pt;"&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="; color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Segoe UI','sans-serif'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Segoe UI','sans-serif'; color: black; font-size: 10pt;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 17:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135499#M36653</guid>
      <dc:creator>jbear</dc:creator>
      <dc:date>2015-01-23T17:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Access formula to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135500#M36654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; new_num &lt;SPAN style="color: green; font-family: 'Courier New'; font-size: 10pt;"&gt;/*10 character length*/&lt;/SPAN&gt; = put(input(alt_num,best8.),z10.0&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;If Alt_num is character, or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; new_num &lt;SPAN style="color: green; font-family: 'Courier New'; font-size: 10pt;"&gt;/*10 character length*/&lt;/SPAN&gt; = put(alt_num,z10.0&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;if alt_num is numeric&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 17:28:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135500#M36654</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-01-23T17:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Access formula to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135501#M36655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not tell us what this ACCESS formula is meant to do instead of asking us to do all the decoding-recoding work? - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 17:57:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135501#M36655</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-01-23T17:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Access formula to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135502#M36656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PGStats,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wasn't given too much info, but I interpreted the formula like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(a) if conditional: Not Null And [contract_num] Not Like '*[!0-9]*' ----&amp;gt; not null and any character outside 0-9 range is rejected, jumps to false argument&lt;/P&gt;&lt;P&gt;(b) replace statements: stripping some characters, I think the compress deals with this one&lt;/P&gt;&lt;P&gt;(c) the new_num is required to be padded with leading zeroes if len less than 10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that is what it is trying to due...and the false argument uses the alt_num since the condition is based on the contract_num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 18:22:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135502#M36656</guid>
      <dc:creator>jbear</dc:creator>
      <dc:date>2015-01-23T18:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Access formula to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135503#M36657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this then,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input (contract alt) (:$20.) ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;6733708564/67821 2 0000000002&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if missing(contract) or notdigit(trim(contract)) &amp;gt; 0 then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new = put(input(compress(alt, "-/ "), best.), z10.0);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;else new = put(input(compress(contract, "-/ "), best.), z10.0);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc print; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 18:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135503#M36657</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-01-23T18:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Access formula to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135504#M36658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent...it worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jan 2015 21:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Access-formula-to-SAS/m-p/135504#M36658</guid>
      <dc:creator>jbear</dc:creator>
      <dc:date>2015-01-30T21:33:23Z</dc:date>
    </item>
  </channel>
</rss>

