<?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: Variable more than one delimiter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743561#M232828</link>
    <description>&lt;P&gt;no some times in the variable just test1 and test 3 like that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variable&amp;nbsp;&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;test1;ll,test3:p12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no words "test2"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I want to use always&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;the words test1, test2, and test3 the new Variable names&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 14:16:16 GMT</pubDate>
    <dc:creator>Beecelal</dc:creator>
    <dc:date>2021-05-25T14:16:16Z</dc:date>
    <item>
      <title>Variable more than one delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743553#M232825</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you please help me. I have one Variable with two delimiters ( : and , )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Variable&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;test1:aaaa,test2:bbbb,test3:ccc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;test2:ddd,test1:ee25,test3:ffffff&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;test3:gg,test1:h,test2:jj12&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to extract the Variables &lt;EM&gt;&lt;STRONG&gt;test1&lt;/STRONG&gt; &lt;/EM&gt;to &lt;EM&gt;&lt;STRONG&gt;test3&lt;/STRONG&gt; &lt;/EM&gt;with the Values.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;EM&gt;&lt;STRONG&gt;test1&lt;/STRONG&gt;&lt;/EM&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;&lt;STRONG&gt;test2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;&lt;STRONG&gt;test3&lt;/STRONG&gt;&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;aaaa&lt;/TD&gt;&lt;TD&gt;bbbb&lt;/TD&gt;&lt;TD&gt;ccc&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ee25&lt;/TD&gt;&lt;TD&gt;ddd&lt;/TD&gt;&lt;TD&gt;ffffff&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;h&lt;/TD&gt;&lt;TD&gt;jj12&lt;/TD&gt;&lt;TD&gt;gg&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 13:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743553#M232825</guid>
      <dc:creator>Beecelal</dc:creator>
      <dc:date>2021-05-25T13:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Variable more than one delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743558#M232826</link>
      <description>&lt;P&gt;The SCAN function allows you to separate "words" using multiple delimiters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are the words TEST1 TEST2 TEST3 always present in every row, or could there be other words like TEST4 or GORILLA?&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 14:07:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743558#M232826</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-25T14:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Variable more than one delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743561#M232828</link>
      <description>&lt;P&gt;no some times in the variable just test1 and test 3 like that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variable&amp;nbsp;&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;test1;ll,test3:p12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no words "test2"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I want to use always&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;the words test1, test2, and test3 the new Variable names&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 14:16:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743561#M232828</guid>
      <dc:creator>Beecelal</dc:creator>
      <dc:date>2021-05-25T14:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Variable more than one delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743562#M232829</link>
      <description>&lt;P&gt;Looks like you have name/value pairs.&amp;nbsp; So generate a data structure that reflects that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tall ;
  set have ;
  do index=1 by 1 until(index&amp;gt;= countw(variable,','));
    length name $32 value $200 ;
    value = scan(variable,index,'.');
    name=scan(value,1,':');
    value=scan(value,2,':');
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to generate that flattened file then using PROC TRANSPOSE.&amp;nbsp; Let's assume you also have a variable named ID that uniquely identifies the rows of the original dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=tall out=want(drop=_name_);
  by id ;
  var value;
  id name;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 14:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743562#M232829</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-25T14:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Variable more than one delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743570#M232834</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/355483"&gt;@Beecelal&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to try the "_infile_ trick":&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input variable $50.;
cards;
test1:aaaa,test2:bbbb,test3:ccc
test2:ddd,test1:ee25,test3:ffffff
test3:gg,test1:h,test2:jj12
test1:ll,test3:p12
;

data want(keep=test:);
set have;
infile sasautos(verify.sas);
if _n_=1 then input @;
_infile_=translate(variable,'=',':,');
input @1 (test1-test3)(= :$10.) @@; /* increase length 10 if insufficient */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 May 2021 14:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-more-than-one-delimiter/m-p/743570#M232834</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-05-25T14:43:21Z</dc:date>
    </item>
  </channel>
</rss>

