<?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 can I create a dataset with all unique values of over 100 variables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81578#M17585</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Linlin,&lt;/P&gt;&lt;P&gt;Use a variable list a--c to refer to your 100 variables (assuming they are listed consecutively) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data have;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;input (a b c) ($);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;cards;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;dd ee ff&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ff hh gg&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ss dd hh&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;data list;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array _a{*} a--c;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i = 1 to dim(_a);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = _a{i};&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;create table uniqueValues as&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;select unique value from list;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;select * from uniqueValues;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 May 2013 18:30:23 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2013-05-21T18:30:23Z</dc:date>
    <item>
      <title>How can I create a dataset with all unique values of over 100 variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81575#M17582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;How should I get what I want?&lt;/P&gt;&lt;P&gt;Thank you very much for your input!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input (a b c) ($);&lt;BR /&gt;cards;&lt;BR /&gt;dd ee ff&lt;BR /&gt;ff hh gg&lt;BR /&gt;ss dd hh&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;observations in the dataset I want:&lt;/P&gt;&lt;P&gt;dd&lt;BR /&gt;ee&lt;BR /&gt;ff&lt;BR /&gt;hh&lt;BR /&gt;gg&lt;BR /&gt;ss&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2013 18:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81575#M17582</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-05-21T18:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a dataset with all unique values of over 100 variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81576#M17583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rotate the data into a single column and let proc sort/FREQ/SQL find the distinct values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data middle / view=middle;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array _all a b c;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do over _all;&amp;nbsp; value = _all; output; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data=middle ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; tables value / out=want missing;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2013 18:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81576#M17583</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-05-21T18:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a dataset with all unique values of over 100 variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81577#M17584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or Hash():&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input (a b c) ($);&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;dd ee ff&lt;/P&gt;&lt;P&gt;ff hh gg&lt;/P&gt;&lt;P&gt;ss dd hh&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_=1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; declare hash h();&lt;/P&gt;&lt;P&gt;h.definekey('newvar');&lt;/P&gt;&lt;P&gt;h.definedata('newvar');&lt;/P&gt;&lt;P&gt;h.definedone();&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array t _character_; &lt;/P&gt;&lt;P&gt;&amp;nbsp; length newvar $ 8;&lt;/P&gt;&lt;P&gt;call missing(newvar);&lt;/P&gt;&lt;P&gt;do over t;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rc=h.replace(key:t, data:t);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;if last then rc=h.output(dataset:'want');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2013 18:26:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81577#M17584</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-05-21T18:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a dataset with all unique values of over 100 variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81578#M17585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Linlin,&lt;/P&gt;&lt;P&gt;Use a variable list a--c to refer to your 100 variables (assuming they are listed consecutively) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data have;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;input (a b c) ($);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;cards;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;dd ee ff&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ff hh gg&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ss dd hh&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;data list;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;array _a{*} a--c;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;do i = 1 to dim(_a);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = _a{i};&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;create table uniqueValues as&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;select unique value from list;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;select * from uniqueValues;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2013 18:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81578#M17585</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-05-21T18:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a dataset with all unique values of over 100 variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81579#M17586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom, Haikuo, and PG:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your help&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;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;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;!!! - Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2013 18:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81579#M17586</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-05-21T18:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a dataset with all unique values of over 100 variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81580#M17587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow, three excellent ways to solve the problem!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 17:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-a-dataset-with-all-unique-values-of-over-100/m-p/81580#M17587</guid>
      <dc:creator>sandyming</dc:creator>
      <dc:date>2013-07-02T17:55:27Z</dc:date>
    </item>
  </channel>
</rss>

