<?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: indexing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455218#M115130</link>
    <description>&lt;P&gt;If you want to avoid sorting, you can use proc sql for the joins, but that will take time on its own.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Apr 2018 14:43:06 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-04-18T14:43:06Z</dc:date>
    <item>
      <title>indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455190#M115113</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I want to&amp;nbsp;insert some values into all tables in test library by using&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;test macro. But some tables have indexes some tables doesn't &amp;nbsp;, when I am sorting the tables to merge , it is not creating the indexes (sorting will remove the index). I tried to&amp;nbsp;get indexs from &amp;nbsp;(sashelp.vindex). transpose the values and concatenate them in one variable&amp;nbsp; and create a macro . I applied the indexes to the final dataset but the performance is too poor to apply for all the tables.&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;I&gt;note:100 tables in test library with huge records.&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro a (inLibref);
ods output Members=Members;
 proc datasets library=&amp;amp;inLibref memtype=data;
 run;
 quit;
    %local datasetCount iter inLibref inMember;

    /*get number of datasets*/
    proc sql noprint;
        select count(*)
         into :datasetCount
        from WORK.Members;
		%put " dataset count is:&amp;amp;datasetCount."
    quit;

    /*initiate loop*/
    %let iter=1;
    %do %while (&amp;amp;iter.&amp;lt;= &amp;amp;datasetCount.);
        data _NULL_;
            set WORK.Members (firstobs=&amp;amp;iter. obs=&amp;amp;iter.);
            call symput("inMember",strip(Name));
          
        run;
proc sort data=&amp;amp;inLibref..&amp;amp;inMember. ;
			by id;
		run;
		proc sort data=a;
			by id;
		run;
		data &amp;amp;inLibref..&amp;amp;inMember.;
			merge  &amp;amp;inLibref..&amp;amp;inMember.(in=a) a(in=b);
					by id;
					if a=b then do;
		%test(&amp;amp;inLibref..&amp;amp;inMember.);
					end;
			if a then output;
		run;
		%let iter=%eval(&amp;amp;iter.+1);
    %end;
proc datasets library=work;
   delete Members;
run;
quit;
%mend a;
%a(test);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455190#M115113</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-18T14:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455201#M115120</link>
      <description>&lt;P&gt;Sorry, your post is a bit confusing.&amp;nbsp; There is a call to %test in the code, but I don't see a test macro anywhere?&lt;/P&gt;
&lt;P&gt;Second, I don't see anything "index" related here?&lt;/P&gt;
&lt;P&gt;Third, it looks like your code is merging a dataset test, to every dataset in a library, is this right?&amp;nbsp; Not being able to see either test or the original datasets, I can't tell, but this does seem to be the most intensive method of adding items from one dataset to another.&amp;nbsp; Show some test data for base and for test (in the form of a datastep).&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just as a tip, you can cut half the code off by simply:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vtables (where=(libname="WORK"));
  call execute('data ...; set ...; run;');
run;&lt;/PRE&gt;
&lt;P&gt;This will run the call execute for every member in work, with need to for counting, looping etc.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455201#M115120</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-18T14:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455214#M115126</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;base&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;id&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;name&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;qq&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;aa&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;ss&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;4&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;ss&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;5&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;dd&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;dff&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;7&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;vff&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;gggg&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;9&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;ggggg&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;10&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;rrr&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;11&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;sss&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;12&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;ssss&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;13&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;dddd&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;14&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;sssss&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;a&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;id&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;5&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;7&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;10&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;%&lt;STRONG&gt;&lt;I&gt;test&lt;/I&gt;&lt;/STRONG&gt; macro&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;if name ne &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; then name=&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'XXXXX'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;CODE class=" language-sas"&gt;
%macro a (inLibref);
	ods output Members=Members;

	proc datasets library=&amp;amp;inLibref memtype=data;
	run;

	quit;

	data Members(drop=memname rename=(name=memname));
		length libname $8.memname $32.;
		set Members;
		libname="&amp;amp;inLibref";
	run;

	data Vindex;
		set sashelp.Vindex;
		where libname="&amp;amp;inLibref";
	run;

	proc sort data=Vindex;
		by libname memname;
	run;

	proc sort data=Members;
		by libname memname;
	run;

	data Members(keep=indxname memname libname);
		merge Members(in=a) Vindex (in=b);
		by  libname memname;

		if a and b;
	run;

	proc transpose data=Members out=Members_1;
		by libname memname;
		var indxname;
	run;

	data Members(keep=memname index_var);
		set Members_1;
		index_var=compbl(cat(of COL:));
	run;

	%local datasetCount iter inLibref inMember;

	/*get number of datasets*/
	proc sql noprint;
		select count(*)
			into :datasetCount
				from WORK.Members;
		%put " dataset count is:&amp;amp;datasetCount."
		quit;

		/*initiate loop*/
		%let iter=1;

		%do %while (&amp;amp;iter.&amp;lt;= &amp;amp;datasetCount.);

	data _NULL_;
		set WORK.Members (firstobs=&amp;amp;iter. obs=&amp;amp;iter.);
		call symput("inMember",strip(Name));
		call symput("index",index_var);
	run;

	proc sort data=&amp;amp;inLibref..&amp;amp;inMember.;
		by id;
	run;

	proc sort data=a;
		by id;
	run;

	data &amp;amp;inLibref..&amp;amp;inMember.(index=(&amp;amp;index));
		merge  &amp;amp;inLibref..&amp;amp;inMember.(in=a) a(in=b);
		by id;

		if a=b then
			do;
				%test(&amp;amp;inLibref..&amp;amp;inMember.);
			end;

		if a then
			output;
	run;

	%let iter=%eval(&amp;amp;iter.+1);
		%end;

		proc datasets library=work;
			delete Members;
		run;

		quit;

%mend a;

%a(test);&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455214#M115126</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-18T14:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455215#M115127</link>
      <description>&lt;P&gt;Sorry, but this code-block is totally unreadable. Please post formatted code using {i} icon above the text box.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455215#M115127</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-04-18T14:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455216#M115128</link>
      <description>&lt;P&gt;And the definition of macro %test is still missing.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455216#M115128</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-18T14:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455217#M115129</link>
      <description>&lt;P&gt;Sorry, you will need to sort that code block out.&lt;/P&gt;
&lt;P&gt;Pleas post test data in the form of a datastep, with some relevant data.&amp;nbsp; You show and empty base dataset, and another empty one.&lt;/P&gt;
&lt;P&gt;With that all I can suggest is:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vtable (where=(libname="WORK"));
  call execute(cat('data ',memname,'; merge ',memname,' test; by id; if a and b; run;'));
run; &lt;/PRE&gt;
&lt;P&gt;This will create for each dataset in work, the datastep code to merge that dataset with test based on ID&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455217#M115129</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-18T14:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455218#M115130</link>
      <description>&lt;P&gt;If you want to avoid sorting, you can use proc sql for the joins, but that will take time on its own.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455218#M115130</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-18T14:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455221#M115131</link>
      <description>replace %test(&amp;amp;inLibref..&amp;amp;inMember.); with this ( if name ne ' ' then name='XXXXX';)</description>
      <pubDate>Wed, 18 Apr 2018 14:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455221#M115131</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-18T14:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455233#M115138</link>
      <description>&lt;PRE&gt;%macro a (inLibref);
ods output Members=Members;
 proc datasets library=&amp;amp;inLibref memtype=data;
 run;
 quit;
 data Members(drop=memname rename=(name=memname));
 length libname $8.memname $32.  ;
 set Members;
libname="&amp;amp;inLibref";
run;
data Vindex;
set sashelp.Vindex;
where libname="&amp;amp;inLibref";
run;
proc sort data=Vindex;
by libname memname ;
run;
proc sort data=Members ;
by libname memname ;
run;
data Members(keep=indxname memname libname)  ;
merge Members(in=a) Vindex (in=b);
by  libname memname ;
if a and b  ;
run;

proc transpose data=Members out=Members_1 ;
by libname memname;
var indxname;
run;


data Members(keep=memname index_var);
set Members_1;
index_var=compbl(cat(of COL:)); 
run;
    %local datasetCount iter inLibref inMember;

    /*get number of datasets*/
    proc sql noprint;
        select count(*)
         into :datasetCount
        from WORK.Members;
		%put " dataset count is:&amp;amp;datasetCount."
    quit;

    /*initiate loop*/
    %let iter=1;
    %do %while (&amp;amp;iter.&amp;lt;= &amp;amp;datasetCount.);
        data _NULL_;
            set WORK.Members (firstobs=&amp;amp;iter. obs=&amp;amp;iter.);
            call symput("inMember",strip(Name));
			call symput("index",index_var);
          
        run;
proc sort data=&amp;amp;inLibref..&amp;amp;inMember. ;
			by id;
		run;
		proc sort data=a;
			by id;
		run;
		data &amp;amp;inLibref..&amp;amp;inMember.(index=(&amp;amp;index));
			merge  &amp;amp;inLibref..&amp;amp;inMember.(in=a) a(in=b);
					by id;
					if a=b then do;
		if name ne ' ' then name='XXXXX';
					end;
			if a then output;
		run;
		%let iter=%eval(&amp;amp;iter.+1);
    %end;
proc datasets library=work;
   delete Members;
run;
quit;
%mend a;
%a(test);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455233#M115138</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-18T14:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455235#M115139</link>
      <description>yes, but my logic (%test macro) is in base sas&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455235#M115139</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-04-18T14:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455276#M115146</link>
      <description>&lt;P&gt;I will try again,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Please post test data in the form of a datastep, with some relevant data.&amp;nbsp; You show and empty base dataset, and another empty one.&lt;/P&gt;
&lt;P&gt;With that all I can suggest is:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vtable (where=(libname="WORK"));
  call execute(cat('data ',memname,'; merge ',memname,' test; by id; if a and b; run;'));
run; &lt;/PRE&gt;
&lt;P&gt;This will create for each dataset in work, the datastep code to merge that dataset with test based on ID&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do not need any of the code you present, the datastep shown will do exactly the same thing, you just need to alter it slightly to your specific task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 18 Apr 2018 16:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455276#M115146</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-18T16:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: indexing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455667#M115312</link>
      <description>&lt;P&gt;Are you perhaps looking for something like the INDEX CREATE statement in Proc Datasets to create an index on variables already in the data sets?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 16:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/indexing/m-p/455667#M115312</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-19T16:46:25Z</dc:date>
    </item>
  </channel>
</rss>

