<?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: Creating a Variable Based on the 4th Position of Another in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Variable-Based-on-the-4th-Position-of-Another/m-p/480575#M286613</link>
    <description>&lt;P&gt;You can use the ANYDIGIT function to determine whether or not the character is numeric or not.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0gq8bwobt4wjgn12km94wi66mxw.htm&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0gq8bwobt4wjgn12km94wi66mxw.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jul 2018 18:22:39 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-07-23T18:22:39Z</dc:date>
    <item>
      <title>Creating a Variable Based on the 4th Position of Another</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Variable-Based-on-the-4th-Position-of-Another/m-p/480573#M286612</link>
      <description>&lt;P&gt;For flights in our airspace, we assign a flight an ACID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Examples: ACA690, FVWT, ENY3356, FCHC (there are always at least 4 characters)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to do is to go to the 4th position and assess if it is numeric or a character. If it is numeric, I want to grab the first three characters of the ACID and dump it into the variable iacocode. If the 4th position character is not numeric, then assign icaocode to be "UKN".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For so ACA690, icaocode would be "ACA", for FVWT it would be "UKN"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2018 18:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Variable-Based-on-the-4th-Position-of-Another/m-p/480573#M286612</guid>
      <dc:creator>BCNAV</dc:creator>
      <dc:date>2018-07-23T18:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Variable Based on the 4th Position of Another</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Variable-Based-on-the-4th-Position-of-Another/m-p/480575#M286613</link>
      <description>&lt;P&gt;You can use the ANYDIGIT function to determine whether or not the character is numeric or not.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0gq8bwobt4wjgn12km94wi66mxw.htm&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0gq8bwobt4wjgn12km94wi66mxw.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2018 18:22:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Variable-Based-on-the-4th-Position-of-Another/m-p/480575#M286613</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-23T18:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Variable Based on the 4th Position of Another</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Variable-Based-on-the-4th-Position-of-Another/m-p/480577#M286614</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input var $10.;
cards;
ACA690
FVWT
ENY3356
FCHC
;

data want;
set have;
iacocode=ifc(anydigit(char(var,4))&amp;gt;0,substr(var,1,3),"UKN");
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Jul 2018 18:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Variable-Based-on-the-4th-Position-of-Another/m-p/480577#M286614</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-23T18:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Variable Based on the 4th Position of Another</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-Variable-Based-on-the-4th-Position-of-Another/m-p/480584#M286615</link>
      <description>&lt;P&gt;You can also use COMPRESS function to identify numeric and characters in a string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ifc(missing(compress(substr(var,4,1),,'d')),substr(var,1,3),'UNK')&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Jul 2018 18:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-Variable-Based-on-the-4th-Position-of-Another/m-p/480584#M286615</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-07-23T18:41:38Z</dc:date>
    </item>
  </channel>
</rss>

