<?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: Use Hash Object in Macro in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Use-Hash-Object-in-Macro/m-p/624739#M20166</link>
    <description>&lt;P&gt;Don't convert your DATA step DO loop:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro csv(howmany);
%do i = 1 %to &amp;amp;howmany;
data temp&amp;amp;i;
	if _N_ = 1 then do;
	declare hash VET(dataset: 'Base');
	VET.definekey('org');
	VET.definedone();
	end;
	set Sheet&amp;amp;i;
	FLAG = VET.check('org');
run;
%end;
%mend csv;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Feb 2020 06:14:18 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2020-02-14T06:14:18Z</dc:date>
    <item>
      <title>Use Hash Object in Macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-Hash-Object-in-Macro/m-p/624738#M20165</link>
      <description>&lt;P&gt;Hi! Thanks in advance for your help!&lt;/P&gt;&lt;P&gt;I have two data sets(Base and Sheet1). They have a common key, let's say "ID". I want to create a "flag" = 1 in Sheet1 if ID from Sheet1 is shown in Base and flag = 0 otherwise. I did this following the code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp1; 
	if _N_ = 1 then do;
		declare hash VET(dataset: 'Base');
		VET.definekey('org');
		VET.definedone();
	end;
	set Sheet1;
	FLAG = VET.check();
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This works perfectly fast. However, I have many "Sheet1", let's say Shee1 - Sheet300 (I ran a macro to read those 300 files to the library.work). I want to perform the same procedure on them. So I wrote a macro:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro csv(howmany);
%do i = 1 %to &amp;amp;howmany;
data temp&amp;amp;i;
	%if _N_ = 1 %then %do;
	declare hash VET(dataset: 'Base');
	VET.definekey('org');
	VET.definedone();
	%end;
	set Sheet&amp;amp;i;
	FLAG = VET.check('org');
run;
%end;
%mend csv;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then I ran into an error. It says:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: DATA STEP Component Object failure.  Aborted during the COMPILATION phase.
ERROR 557-185: Variable VET is not an object.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After this step, I want to stack/append (proc append) those observations with Flag =1. I imagine this will take much of the space since we read them in and store them. Any more efficient way?&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;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 06:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-Hash-Object-in-Macro/m-p/624738#M20165</guid>
      <dc:creator>maxjiang6999</dc:creator>
      <dc:date>2020-02-14T06:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Use Hash Object in Macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-Hash-Object-in-Macro/m-p/624739#M20166</link>
      <description>&lt;P&gt;Don't convert your DATA step DO loop:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro csv(howmany);
%do i = 1 %to &amp;amp;howmany;
data temp&amp;amp;i;
	if _N_ = 1 then do;
	declare hash VET(dataset: 'Base');
	VET.definekey('org');
	VET.definedone();
	end;
	set Sheet&amp;amp;i;
	FLAG = VET.check('org');
run;
%end;
%mend csv;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 06:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-Hash-Object-in-Macro/m-p/624739#M20166</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-02-14T06:14:18Z</dc:date>
    </item>
  </channel>
</rss>

