<?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: Index files? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436937#M108737</link>
    <description>&lt;P&gt;below is pasted from SAS documentation,&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279149.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279149.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;which will explain whether indexes are used by your query or not. below is some notes from the link above&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if MSGLEVEL=I, SAS writes informative messages to the SAS log about index processing. In general, when a WHERE expression is executed for a data set with indexes, the following information appears in the SAS log:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;A name="a000851058" target="_blank"&gt;&lt;/A&gt;if an index is used, a message displays that specifies the name of the index&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;A name="a000851059" target="_blank"&gt;&lt;/A&gt;if an index is not used but one exists that could optimize at least one condition in the WHERE expression, messages provide suggestions that describe what you can do to influence SAS to use the index. For example, a message could suggest sorting the data set into index order or to specify more buffers.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;please also look into below paper, which explain under what conditions indexes are useful.&amp;nbsp; data access through is effcient many times but not all the times and hence some queries do not use&amp;nbsp; indexes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;read below paper which explains details about sas indexes and their usage&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi30/247-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/247-30.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279149.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279149.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Feb 2018 00:14:05 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2018-02-14T00:14:05Z</dc:date>
    <item>
      <title>Index files?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436908#M108721</link>
      <description>&lt;P&gt;I am confused about Indexes. I think I need them on a particularly large file but the online help info is leaving me scratching my head.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;H2 class="xis-title"&gt;"The Index File&lt;/H2&gt;
&lt;DIV id="n0pmlm1tph1ahkn1nbgdmb6o2ke5" class="xis-topicContent"&gt;
&lt;DIV id="n08qsvce39h74nn1jbsmdjrzqugd" class="xis-paragraph"&gt;The index file is a SAS file that has the same name as its associated data file, and that has a member type of INDEX. There is only one index file per data file. That is, all indexes for a data file are stored in a single file.&lt;/DIV&gt;
&lt;DIV id="n1pr2eh2fftyktn1dxmyzdxca9sj" class="xis-paragraph"&gt;&lt;STRONG&gt;The index file might be a separate file, or be part of the data file,&lt;/STRONG&gt; depending on the operating environment. In any case, the index file is stored in the same SAS library as its data file."&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=n06cy7dznbx6gen1q9mat8de6rdq.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;from this documentation page&lt;/A&gt;.
&lt;DIV id="n0pmlm1tph1ahkn1nbgdmb6o2ke5" class="xis-topicContent"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="xis-paragraph"&gt;So I am working on Windows10 PC saving my data on our file server. I read in a 4.5 Million obs data set, and add indexes to this data set, check with the "options msglevel=I;" and a proc contents my data set, I see my indexes listed as expected. I do a simple data step write to the file server, but do not see an index file, no problem this help says it can be internal. I close my program and write a simple read data set program and check proc contents and the indexes are gone.&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;Have I missed something??&amp;nbsp; Shouldn't the index be internal and available&amp;nbsp;to my second program? Did i miss an option?&lt;/STRONG&gt;&lt;/U&gt;&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 Jul 2020 18:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436908#M108721</guid>
      <dc:creator>kjohnsonm</dc:creator>
      <dc:date>2020-07-01T18:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Index files?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436932#M108732</link>
      <description>&lt;P&gt;Can you show the code of how you read the data and added the index? And how you did the "simple data step write to the file server"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that you did not COPY&amp;nbsp; the data set which would preserve the index but did something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data servlib.mydata;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set myindexeddataset;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which creates a new data set without an index.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 00:06:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436932#M108732</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-14T00:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Index files?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436935#M108735</link>
      <description>&lt;P&gt;options nocenter;options ls=256;title1 ;footnote1 ;&lt;BR /&gt;options mlogic mprint merror symbolgen;&lt;BR /&gt;options msglevel=I;&lt;BR /&gt;libname adm odbc dsn=adm schema = dbo;&lt;BR /&gt;%Let FName = %SysGet( SAS_EXECFILEPATH ) ;&lt;BR /&gt;%put &amp;amp;fname;&lt;BR /&gt;%let sasfile= %sysget(SAS_EXECFILEname);&lt;BR /&gt;%put &amp;amp;sasfile ;&lt;BR /&gt;%Let PName = %qsubstr(%sysget(SAS_EXECFILEPATH),1, %length(%sysget(SAS_EXECFILEPATH))-%length(%sysget(SAS_EXECFILEname))) ;&lt;BR /&gt;%put &amp;amp;pname;&lt;BR /&gt;%let currentfolder=%scan(&amp;amp;pname,1,'\',B);&lt;BR /&gt;%put &amp;amp;currentfolder.;&lt;BR /&gt;%let parentpath=%sysfunc(tranwrd(&amp;amp;pname,&amp;amp;currentfolder.\,));&lt;BR /&gt;%put &amp;amp;parentpath.;&lt;BR /&gt;libname data "&amp;amp;pname";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* I have dumped a large amound of fields just for shortening this up */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table UGRD_application_vw_&amp;amp;current_set. as&lt;BR /&gt;SELECT&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SNAP_DATE &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,STRM &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,ADMIT_TERM &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,EMPLID &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,last_name &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,first_name &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,middle_name &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,name_suffix &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,name_display &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,sex &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,birthdate &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,age &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; FROM&amp;nbsp; adm.UGRD_application_vw&lt;BR /&gt;&amp;nbsp; where strm in ("&amp;amp;max_of_STRM.")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp;create index emplid &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on UGRD_application_vw_&amp;amp;current_set.;&lt;BR /&gt;&amp;nbsp;create index SNAP_DATE_STRM_admit_type_emplid &amp;nbsp;on UGRD_application_vw_&amp;amp;current_set.(SNAP_DATE, STRM, admit_type, emplid);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc contents data=UGRD_application_vw_&amp;amp;current_set.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data data.VA_DATA_&amp;amp;current_set.;&lt;BR /&gt;&amp;nbsp; set work.UGRD_application_vw_&amp;amp;current_set.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* and sorry I did not make a data set, I was just thinking maybe I left an option out and it was in the the contents of work, I see a folder there but it is not an index file&amp;nbsp; */ &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 00:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436935#M108735</guid>
      <dc:creator>kjohnsonm</dc:creator>
      <dc:date>2018-02-14T00:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Index files?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436937#M108737</link>
      <description>&lt;P&gt;below is pasted from SAS documentation,&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279149.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279149.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;which will explain whether indexes are used by your query or not. below is some notes from the link above&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if MSGLEVEL=I, SAS writes informative messages to the SAS log about index processing. In general, when a WHERE expression is executed for a data set with indexes, the following information appears in the SAS log:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;A name="a000851058" target="_blank"&gt;&lt;/A&gt;if an index is used, a message displays that specifies the name of the index&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;A name="a000851059" target="_blank"&gt;&lt;/A&gt;if an index is not used but one exists that could optimize at least one condition in the WHERE expression, messages provide suggestions that describe what you can do to influence SAS to use the index. For example, a message could suggest sorting the data set into index order or to specify more buffers.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;please also look into below paper, which explain under what conditions indexes are useful.&amp;nbsp; data access through is effcient many times but not all the times and hence some queries do not use&amp;nbsp; indexes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;read below paper which explains details about sas indexes and their usage&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi30/247-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/247-30.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279149.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279149.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 00:14:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436937#M108737</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-02-14T00:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Index files?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436938#M108738</link>
      <description>&lt;P&gt;I did not know this "&lt;SPAN&gt;which creates a new data set without an index.&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;can you share a sample&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 00:14:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436938#M108738</guid>
      <dc:creator>kjohnsonm</dc:creator>
      <dc:date>2018-02-14T00:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Index files?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436943#M108742</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/43996"&gt;@kjohnsonm&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I did not know this "&lt;SPAN&gt;which creates a new data set without an index.&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;can you share a sample&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;data work.class(index=(name));
   set sashelp.class;
run;

proc contents data=work.class;
run;

data work.class2;
   set work.class;
run;

proc contents data=work.class2;
run;&lt;/PRE&gt;
&lt;P&gt;The first data set made, work.class explicitly has an index.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when I run the second data step creating work.class2 there is no index specified.&lt;/P&gt;
&lt;P&gt;Without that instruction work.class2 will not have an index.&lt;/P&gt;
&lt;P&gt;In your code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data data.VA_DATA_&amp;amp;current_set.;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;=&amp;nbsp; no index statement so this NEW data set does not have an index.&lt;BR /&gt;&amp;nbsp; set work.UGRD_application_vw_&amp;amp;current_set.;&amp;nbsp; &amp;lt;= the data set referenced here had the index created&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either add the INDEX option on the new set or use Proc Datasets with the Copy instruction to copy the data set and use the options to include the index.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 00:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436943#M108742</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-14T00:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: Index files?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436946#M108743</link>
      <description>I had seen this style of code but falsely assumed it was just an variation on a way to write indexes. That is very big wrong in this case.  thanks -KJ</description>
      <pubDate>Wed, 14 Feb 2018 01:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Index-files/m-p/436946#M108743</guid>
      <dc:creator>kjohnsonm</dc:creator>
      <dc:date>2018-02-14T01:00:06Z</dc:date>
    </item>
  </channel>
</rss>

