<?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 how to create new variables based on information from old variables? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60928#M17274</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;dictionary tables already contains the number of character variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt; select num_character&lt;/P&gt;&lt;P&gt;&amp;nbsp; from dictionary.tables &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where libname='SASHELP' and memname='CLASS';&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Sep 2011 02:45:38 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-09-07T02:45:38Z</dc:date>
    <item>
      <title>how to create new variables based on information from old variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60923#M17269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suppose I have following codes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;set old;&lt;/P&gt;&lt;P&gt;array old_var_array&lt;LI&gt; _CHARACTER_;&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;..................(codes to be inserted)&lt;/P&gt;&lt;P&gt;..................(codes to be inserted)&lt;/P&gt;&lt;P&gt;..................(codes to be inserted)&lt;/P&gt;&lt;P&gt;..................(codes to be inserted)&lt;/P&gt;&lt;P&gt;..................&lt;/P&gt;&lt;P&gt;..................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on number of character variables ( which can be obtained using dim(old_var_array) in the above example), I want to create equal number of new variables (NewVar1-NewVar#ofChar). How can I do this? thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 16:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60923#M17269</guid>
      <dc:creator>littlestone</dc:creator>
      <dc:date>2011-09-06T16:23:45Z</dc:date>
    </item>
    <item>
      <title>how to create new variables based on information from old variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60924#M17270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a look at the method I suggested in a post the other day:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/message/104323#104323"&gt;http://communities.sas.com/message/104323#104323&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 16:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60924#M17270</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-06T16:42:01Z</dc:date>
    </item>
    <item>
      <title>how to create new variables based on information from old variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60925#M17271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much.The code you gave to me works perfectly for me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, I find another way that can also do the job. Here is the code (I am not sure if this method is considered professional or not):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data _Null_;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set old;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;array stringvar&lt;/STRONG&gt;&lt;LI&gt;&lt;STRONG&gt; _CHARACTER_;&lt;/STRONG&gt;&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NumofCVar = dim(stringvar) ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call SYMPUTX('NumOfCVar',NumOfCVar);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;set old;&lt;/P&gt;&lt;P&gt;array old_var_array&lt;LI&gt; _CHARACTER_;&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;array _NewVar[&amp;amp;NumofCVar] NewVar1-NewVar&amp;amp;NumofCVar;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;..............&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 18:44:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60925#M17271</guid>
      <dc:creator>littlestone</dc:creator>
      <dc:date>2011-09-06T18:44:56Z</dc:date>
    </item>
    <item>
      <title>how to create new variables based on information from old variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60926#M17272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks almost sufficiently professional enough to me for whatever that is worth.&amp;nbsp; However, I would simplify the first step so that you don't read through all of the records.&amp;nbsp; e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _Null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_ eq 1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array stringvar&lt;LI&gt; _CHARACTER_;&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NumofCVar = dim(stringvar) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call SYMPUTX('NumOfCVar',NumOfCVar);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 18:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60926#M17272</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-06T18:54:55Z</dc:date>
    </item>
    <item>
      <title>how to create new variables based on information from old variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60927#M17273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot for suggestion&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 20:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60927#M17273</guid>
      <dc:creator>littlestone</dc:creator>
      <dc:date>2011-09-06T20:40:30Z</dc:date>
    </item>
    <item>
      <title>how to create new variables based on information from old variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60928#M17274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;dictionary tables already contains the number of character variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt; select num_character&lt;/P&gt;&lt;P&gt;&amp;nbsp; from dictionary.tables &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where libname='SASHELP' and memname='CLASS';&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 02:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60928#M17274</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-09-07T02:45:38Z</dc:date>
    </item>
    <item>
      <title>how to create new variables based on information from old variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60929#M17275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you Ksharp. I actually didn't know there exists "dictionary tables". It is such a wonderful tool. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 14:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-new-variables-based-on-information-from-old/m-p/60929#M17275</guid>
      <dc:creator>littlestone</dc:creator>
      <dc:date>2011-09-07T14:44:11Z</dc:date>
    </item>
  </channel>
</rss>

