<?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: need to create new variables using the one variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394171#M94954</link>
    <description>&lt;P&gt;Whatever you&amp;nbsp;are intending to do with this data, there are probably better ways. &amp;nbsp;But here is one way to get what you ask:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data each_word;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if country &amp;nbsp;&amp;gt; &amp;nbsp;' ' then do _n_= 1 to countw(country);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;word = scan(country, _n_);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;total_words + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;output;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc transpose data=each_word out=want (drop=_name_) prefix=var;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;var word;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;id total_words;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Sep 2017 09:44:21 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-09-08T09:44:21Z</dc:date>
    <item>
      <title>need to create new variables using the one variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394160#M94948</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one variable named as Country and it has values below&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;India&lt;BR /&gt;Unites States of America&lt;BR /&gt;United Arab Emirates&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need to create diffrent variables using these values example &lt;STRONG&gt;var1-india var2 United var3-States Var4-of var5-America etc....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this needs to be dynamic ,( not with hardcoded) &amp;nbsp;Please advice&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 09:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394160#M94948</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2017-09-08T09:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: need to create new variables using the one variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394161#M94949</link>
      <description>&lt;P&gt;Quick question: Why? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 09:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394161#M94949</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-09-08T09:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: need to create new variables using the one variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394162#M94950</link>
      <description>&lt;P&gt;Second quick question, what is the question? &amp;nbsp;Post example test data in the form of a datastep using a code window (its the {i}) and what the output should look like. &amp;nbsp; Then explain any logic between. &amp;nbsp;If it is just splitting a string up into component parts then:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array var{5} $200;
  do i=1 to countw(your_string," ");
    var{i}=scan(your_string,i," ");
  end;
run;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Sep 2017 09:27:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394162#M94950</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-09-08T09:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: need to create new variables using the one variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394171#M94954</link>
      <description>&lt;P&gt;Whatever you&amp;nbsp;are intending to do with this data, there are probably better ways. &amp;nbsp;But here is one way to get what you ask:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data each_word;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if country &amp;nbsp;&amp;gt; &amp;nbsp;' ' then do _n_= 1 to countw(country);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;word = scan(country, _n_);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;total_words + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;output;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc transpose data=each_word out=want (drop=_name_) prefix=var;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;var word;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;id total_words;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 09:44:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394171#M94954</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-09-08T09:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: need to create new variables using the one variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394173#M94955</link>
      <description>&lt;P&gt;Hi , This was&amp;nbsp; my need , thanks&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 10:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-create-new-variables-using-the-one-variable/m-p/394173#M94955</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2017-09-08T10:04:43Z</dc:date>
    </item>
  </channel>
</rss>

