<?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: how to separate various values from data string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/265022#M52045</link>
    <description>&lt;P&gt;Please mark it as solved &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2016 07:50:57 GMT</pubDate>
    <dc:creator>Loko</dc:creator>
    <dc:date>2016-04-20T07:50:57Z</dc:date>
    <item>
      <title>how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264728#M51975</link>
      <description>&lt;P&gt;Hi Guys !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to solve below issue:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I`ve got data string like this &amp;nbsp;: &amp;nbsp;{"labelX":"valueX",&lt;SPAN&gt;"labelY":"valueY","labelZ":"valueZ"&lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;I need to split&amp;nbsp;data by comma, where "label" should be the name of column, and rows should be filled with "value"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;LG.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 07:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264728#M51975</guid>
      <dc:creator>lemongrass</dc:creator>
      <dc:date>2016-04-19T07:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264731#M51977</link>
      <description>&lt;P&gt;There are a couple of possibilities. Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; A;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Txt=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%Unquote&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;('{"labelX":"valueX","labelY":"valueY","labelZ":"valueZ"'); &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Output&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; B (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Keep&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=Name Value);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; A;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Txt=Compress(Txt,'"[]'); * please replace with squiggly brackets - I can't get them into the editor here;&lt;/P&gt;
&lt;P&gt;Txt=Translate(Txt,',',':');&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;To&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Count(Txt,',') &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;By&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Name=Scan(Txt,i,',');&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Value=Scan(Txt,i+&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;,',');&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Output&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;End&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;Transpose&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; =B &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Out&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=B_T (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Drop&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=_NAME_);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ID&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Name;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Var&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Value;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 08:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264731#M51977</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2016-04-19T08:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264734#M51979</link>
      <description>&lt;P&gt;Well, to be honest that looks a bit Json like to me. &amp;nbsp;Is it only one string, if so then something like:&lt;/P&gt;
&lt;PRE&gt;data have;
  txt='{"labelX":"valueX","labelY":"valueY","labelZ":"valueZ"}';
  call execute('data want;');
  do i=1 to countw(txt,",");
    call execute(cat(" length ",compress(scan(scan(txt,i,","),1,":"),'"{}')," $100; ",compress(scan(scan(txt,i,","),1,":"),'"{}'),'="',compress(scan(scan(txt,i,","),2,":"),'"{}'),'";'));
  end;
  call execute('run;');
run;&lt;/PRE&gt;
&lt;P&gt;Is probably the quickest way to go. &amp;nbsp;Though I suspect we are only seeing the tiny bit of the picture here. &amp;nbsp;Why do you have that type of string, where does it come from? &amp;nbsp;More information would provide a better solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 08:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264734#M51979</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-19T08:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264735#M51980</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;it comes from IT app LOG FILE, and for that moment it`s looks like that &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;LG&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Apr 2016 08:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264735#M51980</guid>
      <dc:creator>lemongrass</dc:creator>
      <dc:date>2016-04-19T08:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264736#M51981</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;x='{"labelX":"valueX","labelY":"valueY","labelZ":"valueZ"}';&lt;BR /&gt;x=prxchange('s/{|}|"//i',-1,x);&lt;BR /&gt;x=prxchange('s/:/="/i',-1,x);&lt;BR /&gt;x=prxchange('s/,/";/i',-1,x);&lt;BR /&gt;&lt;BR /&gt;call symput ('syn',strip(x)||'";');&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;&amp;amp;syn;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 08:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264736#M51981</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-04-19T08:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264742#M51982</link>
      <description>&lt;P&gt;Post a sample FILE ,and let us test it.&lt;/P&gt;
&lt;P&gt;It is JSON file . and PROC DS2&amp;nbsp;&amp;nbsp;has JSON package, maybe you should look at it.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 09:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/264742#M51982</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-19T09:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/265021#M52044</link>
      <description>&lt;P&gt;Guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I`ve got it ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;thank you All for quick help !!! &amp;nbsp;( SCAN and easy loop was the solution )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wish you best &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;LG&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 07:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/265021#M52044</guid>
      <dc:creator>lemongrass</dc:creator>
      <dc:date>2016-04-20T07:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/265022#M52045</link>
      <description>&lt;P&gt;Please mark it as solved &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 07:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/265022#M52045</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-04-20T07:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/265041#M52050</link>
      <description>&lt;P&gt;not my message...but the solution you have chosen...&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 09:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/265041#M52050</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-04-20T09:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate various values from data string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/265063#M52056</link>
      <description>&lt;P&gt;no worries mate &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;reg.&lt;/P&gt;&lt;P&gt;LG&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 12:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-separate-various-values-from-data-string/m-p/265063#M52056</guid>
      <dc:creator>lemongrass</dc:creator>
      <dc:date>2016-04-20T12:14:49Z</dc:date>
    </item>
  </channel>
</rss>

