<?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: Why is this index not created? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Why-is-this-index-not-created/m-p/560152#M10433</link>
    <description>&lt;P&gt;Actually B is right when the same value of MAKE appears in mulitple groups.&lt;/P&gt;
&lt;P&gt;Here is an example dataset that is NOT sorted, but is Grouped.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;However it contains more than one grouping for the same value of MAKE.&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars;
  input make $10.;
cards;
AUDI
AUDI
BMW
BMW
AUDI
VW
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;153   data dups uniquedata(index=(make/unique));
154     set cars (keep=make);
155     by make notsorted;
156     if first.make then output uniquedata;
157     else output dups;
158   run;

NOTE: There were 6 observations read from the data set WORK.CARS.
NOTE: The data set WORK.DUPS has 2 observations and 1 variables.
NOTE: The data set WORK.UNIQUEDATA has 4 observations and 1 variables.
ERROR: Duplicate values not allowed on index make for file UNIQUEDATA.
ERROR: Index creation failed for one or more indexes.
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 May 2019 14:12:34 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-05-20T14:12:34Z</dc:date>
    <item>
      <title>Why is this index not created?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-this-index-not-created/m-p/560111#M10426</link>
      <description>&lt;P&gt;Another practice exam question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------&lt;/P&gt;&lt;P&gt;The dataset Cars it not sorted, but is grouped by make.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data dups uniquedata(index=(make/unique));

set cars (keep=make);

by make notsorted;

if first.make then output uniquedata;

else output dups;

run;&lt;/PRE&gt;&lt;P&gt;When you compile and execute the program above, what is the result?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A) Uniquedata contains a distinct list of Make in sequenced order.&amp;nbsp;&lt;/P&gt;&lt;P&gt;B)&amp;nbsp; Uniquedata contains a distinct list of Make but not necessarily in sequenced order&lt;/P&gt;&lt;P&gt;C)&amp;nbsp; Uniquedata contains a distinct list of Make&amp;nbsp;but not necessarily in sequenced order, the index was built.&amp;nbsp;&lt;/P&gt;&lt;P&gt;D) The dataset DUPS is also indexed on Make.&lt;/P&gt;&lt;P&gt;--------------------&lt;/P&gt;&lt;P&gt;I answered C, since i couldn't find anything wrong with the code, but the answer is B. Is there any reason this index couldn't&lt;/P&gt;&lt;P&gt;be created?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does the notsorted option somehow cancel the index?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 12:35:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-this-index-not-created/m-p/560111#M10426</guid>
      <dc:creator>Syntas_error</dc:creator>
      <dc:date>2019-05-20T12:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this index not created?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-this-index-not-created/m-p/560147#M10432</link>
      <description>&lt;P&gt;Looks like you are right to me.&lt;/P&gt;
&lt;P&gt;Try it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dups uniquedata(index=(make/unique));
  set sashelp.cars (keep=make);
  by make notsorted;
  if first.make then output uniquedata;
  else output dups;
run;

proc contents data=uniquedata; run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 May 2019 14:02:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-this-index-not-created/m-p/560147#M10432</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-20T14:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this index not created?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-this-index-not-created/m-p/560152#M10433</link>
      <description>&lt;P&gt;Actually B is right when the same value of MAKE appears in mulitple groups.&lt;/P&gt;
&lt;P&gt;Here is an example dataset that is NOT sorted, but is Grouped.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;However it contains more than one grouping for the same value of MAKE.&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cars;
  input make $10.;
cards;
AUDI
AUDI
BMW
BMW
AUDI
VW
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;153   data dups uniquedata(index=(make/unique));
154     set cars (keep=make);
155     by make notsorted;
156     if first.make then output uniquedata;
157     else output dups;
158   run;

NOTE: There were 6 observations read from the data set WORK.CARS.
NOTE: The data set WORK.DUPS has 2 observations and 1 variables.
NOTE: The data set WORK.UNIQUEDATA has 4 observations and 1 variables.
ERROR: Duplicate values not allowed on index make for file UNIQUEDATA.
ERROR: Index creation failed for one or more indexes.
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 14:12:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-this-index-not-created/m-p/560152#M10433</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-20T14:12:34Z</dc:date>
    </item>
  </channel>
</rss>

