<?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: Separating a string value into different variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170952#M32833</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It was supposed to be anydtdte but that didn't work for me either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure there's a simpler way than this, and this only accounts for missing a leading zero, assuming it is for the month. If your date has a single digit day then it won't work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt; text="acq_sale_3xconoffer_8999_nacpg_2102014";&lt;/P&gt;&lt;P&gt; date=input(scan(text, 6, "_"), 8.);&lt;/P&gt;&lt;P&gt; date2=input(put(input(scan(text, 6, "_"), 8.), z8.), mmddyy10.);&lt;/P&gt;&lt;P&gt; format date2 date9.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Apr 2014 21:25:43 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-04-07T21:25:43Z</dc:date>
    <item>
      <title>Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170938#M32819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a variable titled&amp;nbsp; Creative_name which contains long sting values. There are sections in the values which are delimited by a _ . Here is an example of a value: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;acq_sale_3xconoffer_8999_nacpg_2102014&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need is break this out into separate variables by the deliminator. So I need the output to look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="width: 443px; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="52"&gt;&lt;STRONG&gt; LOB&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="64"&gt;&lt;STRONG&gt;Bundle &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="117"&gt;&lt;STRONG&gt;Creative Concept &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="64"&gt;&lt;STRONG&gt;Price&amp;nbsp; &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="78"&gt;&lt;STRONG&gt;Sweetener &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl64" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;" width="68"&gt;&lt;STRONG&gt;Date&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;acq&lt;/TD&gt;&lt;TD class="xl63" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;sale&lt;/TD&gt;&lt;TD class="xl63" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;3xconoffer&lt;/TD&gt;&lt;TD class="xl65" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;$89.99&lt;/TD&gt;&lt;TD class="xl63" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;nacpg&lt;/TD&gt;&lt;TD class="xl66" style="color: #575757; text-align: left; padding: 0px; background-color: transparent; font-family: arial, helvetica, sans-serif;"&gt;10Feb14&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you notice Price and Date are reformatted as well.&amp;nbsp; For Price I always have to enter a decimal place before the last two digest so I turn the variables into currency&amp;nbsp; format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance is greatly appreciated!&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 16:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170938#M32819</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2014-04-07T16:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170939#M32820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the scan function to parse&lt;/P&gt;&lt;P&gt;Use an input function to get the variable as a number&lt;/P&gt;&lt;P&gt;Use a format to apply the currency format. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's an example for Price. Price is a numeric variable and PRICE2 is a character variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; text="acq_sale_3xconoffer_8999_nacpg_2102014";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; price=input(scan(text, 4, "_"), 8.)/100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format price dollar8.2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; price2=put(input(scan(text, 4, "_"), 8.)/100, dollar8.2 -l);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 16:28:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170939#M32820</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-07T16:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170940#M32821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&amp;nbsp; the string values change though. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Could look something like this: &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;acq_newsale_0_CartChat_0_Flash_1192014&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;or this: &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;acq_old_3x_GadgetPotomac_7999_Flash_112014&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so $0.00 or $79.99.&amp;nbsp; The value is not always&amp;nbsp; $89.99&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 16:39:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170940#M32821</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2014-04-07T16:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170941#M32822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might want to add a LENGTH statement before parsing the string.&amp;nbsp; Otherwise the new variables will be longer than you might expect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 16:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170941#M32822</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-04-07T16:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170942#M32823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you're saying the delimiters aren't consistent?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie in the first example the dollar amount is the 4th parameter&lt;/P&gt;&lt;P&gt;and in the 2 new samples above it's the 5th parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do you know how many you'll have, or where it will be? You'll have to add rules for that.&lt;/P&gt;&lt;P&gt;We can only provide answers for the information you provide, so please explain your problem thorough &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 16:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170942#M32823</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-07T16:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170943#M32824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the number of underscores varies, how do you know which word in the string is a money value and which is a date value?&amp;nbsp; First, count the number of underscores by substracting the length of the variable without underscores from the total length of the variable.&amp;nbsp;&amp;nbsp; length without underscores equals length(compress blanks(translate underscores to blanks)).&amp;nbsp; Once you know how many words in the variable, use the scan function to parse out all the individual words that are in the variable.&amp;nbsp; You'll have to figure out from there which word is a dollar value and which is a date.&amp;nbsp; Always be sure to account for an underscore that could be at the end of the variable.&amp;nbsp;&amp;nbsp;&amp;nbsp; var1 = scan(variable,1,'_'); etc.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; If I can find my old code, I'll post it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 17:05:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170943#M32824</guid>
      <dc:creator>jwillis</dc:creator>
      <dc:date>2014-04-07T17:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170944#M32825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rezza. Sorry its always the 5th parameter. Thanks! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 18:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170944#M32825</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2014-04-07T18:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170945#M32826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And again, the value can change but its always a two digit two decimal number (so four characters)&amp;nbsp; or 0. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 19:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170945#M32826</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2014-04-07T19:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170946#M32827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; d;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; string &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$50.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; d = input(scan(string,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;5&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'_'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;),&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;8.2&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; d &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;dollar10.2&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;cards&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;acq_newsale_0_CartChat_0_Flash_1192014&lt;BR /&gt;acq_old_3x_GadgetPotomac_7999_Flash_112014&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;;;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 19:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170946#M32827</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-04-07T19:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170947#M32828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data test;&lt;BR /&gt;infile cards truncover;&lt;BR /&gt;&amp;nbsp; input text $50.;&lt;BR /&gt;&amp;nbsp; price =(input(prxchange('s/(\w+)_(\d+)_(\w+)/$2/',-1,text),8.))/100;&lt;BR /&gt;&amp;nbsp; format price dollar8.2;&lt;BR /&gt;cards;&lt;BR /&gt;acq_newsale_0_CartChat_0_Flash_1192014&lt;BR /&gt;acq_old_3x_GadgetPotomac_7999_Flash_112014&lt;BR /&gt;acq_sale_3xconoffer_8999_nacpg_2102014&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 20:44:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170947#M32828</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2014-04-07T20:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170948#M32829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok I get&amp;nbsp; Price but I'm having issues pulling out date and formatting it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2102014&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test2;&lt;/P&gt;&lt;P&gt;set data; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOB=scan(CreativeName, 1, "_");&lt;/P&gt;&lt;P&gt;&amp;nbsp; Bundle=scan(CreativeName, 3, "_");&lt;/P&gt;&lt;P&gt;&amp;nbsp; CreativeConcept=scan(CreativeName, 4, "_");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; price=input(scan(CreativeName, 5, "_"), 8.)/100;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; date=scan(CreativeName, 8, "_");&amp;nbsp; /*just pulls out the value*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; date2=input(scan(CreativeName, 8, "_", mmddyyyy );&amp;nbsp; /*does not work*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Sweetner=scan(CreativeName, 6, "_");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format price dollar8.2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; price2=put(input(scan(CreativeName, 5, "_"), 8.)/100, dollar8.2 -l);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 20:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170948#M32829</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2014-04-07T20:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170949#M32830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try anydtdte format rather than mmddyyyy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 20:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170949#M32830</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-07T20:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170950#M32831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still does not work &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt; &lt;/P&gt;&lt;P&gt;data test2;&lt;/P&gt;&lt;P&gt;set data; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOB=scan(CreativeName, 1, "_");&lt;/P&gt;&lt;P&gt;&amp;nbsp; Bundle=scan(CreativeName, 3, "_");&lt;/P&gt;&lt;P&gt;&amp;nbsp; CreativeConcept=scan(CreativeName, 4, "_");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; price=input(scan(CreativeName, 5, "_"), 8.)/100;&lt;/P&gt;&lt;P&gt;&amp;nbsp; date2=input(scan(CreativeName, 8, "_", 8.), anydate.); &lt;/P&gt;&lt;P&gt;&amp;nbsp; Sweetner=scan(CreativeName, 6, "_");&lt;/P&gt;&lt;P&gt;&amp;nbsp; date=scan(CreativeName, 8, "_"); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format price dollar8.2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; price2=put(input(scan(CreativeName, 5, "_"), 8.)/100, dollar8.2 -l);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 21:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170950#M32831</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2014-04-07T21:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170951#M32832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any way that you can change the way the raw data are written? The month and the day both need to be two digits. Otherwise, how will you know whether 1122014 is January 12 (1/12) or November 2 (11/2)? A six-digit number is obviously a 1-digit month and 1-digit day and an eight-digit number is obviously a two-digit month and a two-digit year, but a seven-digit date could be a one-digit month and two-digit day or a two-digit month and one-digit day. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;liz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 21:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170951#M32832</guid>
      <dc:creator>Liz_LSU</dc:creator>
      <dc:date>2014-04-07T21:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Separating a string value into different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170952#M32833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It was supposed to be anydtdte but that didn't work for me either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure there's a simpler way than this, and this only accounts for missing a leading zero, assuming it is for the month. If your date has a single digit day then it won't work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt; text="acq_sale_3xconoffer_8999_nacpg_2102014";&lt;/P&gt;&lt;P&gt; date=input(scan(text, 6, "_"), 8.);&lt;/P&gt;&lt;P&gt; date2=input(put(input(scan(text, 6, "_"), 8.), z8.), mmddyy10.);&lt;/P&gt;&lt;P&gt; format date2 date9.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2014 21:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-a-string-value-into-different-variables/m-p/170952#M32833</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-07T21:25:43Z</dc:date>
    </item>
  </channel>
</rss>

