<?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: Lock Error on SAS Dataset Library  when executing multiple PROC import simultaneously in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647032#M193602</link>
    <description>&lt;P&gt;The double exclamation signs are syntactically equivalent to the double pipe character.&lt;/P&gt;
&lt;P&gt;But as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;demonstrated, the other method will also work, but I prefer to use macro elements only when absolutely needed.&lt;/P&gt;</description>
    <pubDate>Tue, 12 May 2020 10:18:12 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-05-12T10:18:12Z</dc:date>
    <item>
      <title>Lock Error on SAS Dataset Library  when executing multiple PROC import simultaneously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647006#M193596</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi , can someone please help me with this error. Thanks,&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Error I am getting:&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;ERROR: Entry lock is not available for IMPORT_STRATEGICFILE.MACRO in catalog WORK.SASMAC1, lock held by IOM ROOT COMP ENV.&lt;/P&gt;
&lt;P&gt;ERROR: The macro IMPORT_STRATEGICFILE could not be saved in the WORK.SASMACR catalog.&amp;nbsp; A previous version of the macro was in use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and could not be replaced.&lt;/P&gt;
&lt;P&gt;ERROR: The SAS Macro Facility has encountered an I/O error.&amp;nbsp; Canceling submitted statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Code that I am executing&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%Macro Import_StrategicFile(rtcf_file,output_file);&lt;BR /&gt;&lt;BR /&gt;%let path1 = xxxx;&lt;BR /&gt;%let reporttab = Records;&lt;BR /&gt;&lt;BR /&gt;proc import&lt;BR /&gt;datafile="&amp;amp;path1\&amp;amp;rtcf_file." out=My_lib.&amp;amp;output_file. dbms=xlsx replace;&lt;BR /&gt;/* datafile="&amp;amp;path1\&amp;amp;rtcf_file." out=work.&amp;amp;output_file. dbms=xlsx replace;*/&lt;BR /&gt;getnames=yes;&lt;BR /&gt;sheet="&amp;amp;reporttab.";&lt;BR /&gt;run;&lt;BR /&gt;/* to move the fimported file to archive location*/&lt;BR /&gt;%sysexec move "&amp;amp;path1\&amp;amp;rtcf_file." "&amp;amp;path1\Archive";&lt;BR /&gt;&lt;BR /&gt;%Mend Import_StrategicFile;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;set wash_file;&lt;BR /&gt;call symput ('file_date',file_date);&lt;BR /&gt;select (actual_file_name);&lt;BR /&gt;when ('AAAA') rc=dosubl('%Import_StrategicFile(AAAA_&amp;amp;file_date.,HI_AAAA)'); /* doing pro import to same library*/&lt;BR /&gt;when ('BBBB') rc=dosubl('%Import_StrategicFile(BBBB_&amp;amp;file_date.,BBBB)'); /* doing pro import to same library*/&lt;BR /&gt;when ('CCCC') rc=dosubl('%Import_StrategicFile(CCCC_&amp;amp;file_date.,CCCC)'); /* doing pro import to same library*/&lt;BR /&gt;otherwise put=hi; &lt;BR /&gt;end;&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 09:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647006#M193596</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2020-05-12T09:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Lock Error on SAS Dataset Library  when executing multiple PROC import simultaneously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647009#M193597</link>
      <description>&lt;P&gt;I have entered&amp;nbsp; " options mprint mlogic ; "&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could that be the issue . I removed that but have not&amp;nbsp; been able to test the code ..&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 09:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647009#M193597</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2020-05-12T09:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Lock Error on SAS Dataset Library  when executing multiple PROC import simultaneously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647022#M193598</link>
      <description>&lt;P&gt;Your code as such won't work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set wash_file;
call symput ('file_date',file_date); /* this is executed at data step _runtime_ */
select (actual_file_name);
when ('AAAA') rc=dosubl('%Import_StrategicFile(AAAA_&amp;amp;file_date.,HI_AAAA)'); /* doing pro import to same library*/
/* the reference to &amp;amp;file_date will not be resolved because of the single quotes */
/* but it won't work anyway, as it would be resolved at data step _compile time _*/
when ('BBBB') rc=dosubl('%Import_StrategicFile(BBBB_&amp;amp;file_date.,BBBB)'); /* doing pro import to same library*/
when ('CCCC') rc=dosubl('%Import_StrategicFile(CCCC_&amp;amp;file_date.,CCCC)'); /* doing pro import to same library*/
otherwise put=hi; /* You try to assign the value of variable hi to variable put; is this what you intended? */
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I suggest these changes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set wash_file;
select (actual_file_name);
  when ('AAAA') rc=dosubl('%Import_StrategicFile(AAAA_' !! strip(file_date) !! ',HI_AAAA)'); /* doing pro import to same library*/
  when ('BBBB') rc=dosubl('%Import_StrategicFile(BBBB_' !! strip(file_date) !! ',BBBB)'); /* doing pro import to same library*/
  when ('CCCC') rc=dosubl('%Import_StrategicFile(CCCC_' !! strip(file_date) !! ',CCCC)'); /* doing pro import to same library*/
  otherwise put=hi; /* change as needed */
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 May 2020 09:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647022#M193598</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-12T09:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Lock Error on SAS Dataset Library  when executing multiple PROC import simultaneously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647026#M193599</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did small experiment. I've created 3 xlsx files `AAAA_X.xlsx`, `BBBB_X.xlsx`, and `CCCC_X.xlsx` in my WORK location, I also created `Archive` subfolder and I used following dataset and MyLib:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname My_lib (work);

data wash_file;
  actual_file_name = 'AAAA'; file_date= "X.xlsx"; output;
  actual_file_name = 'BBBB'; file_date= "X.xlsx"; output;
  actual_file_name = 'CCCC'; file_date= "X.xlsx"; output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;than only change i did with you code was&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path1 = %sysfunc(pathname(work));
%let reporttab = Arkusz1; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to adjust my excels and their names&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;after running:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;resetline;
libname My_lib (work);

data wash_file;
  actual_file_name = 'AAAA'; file_date= "X.xlsx"; output;
  actual_file_name = 'BBBB'; file_date= "X.xlsx"; output;
  actual_file_name = 'CCCC'; file_date= "X.xlsx"; output;
run;

%Macro Import_StrategicFile(rtcf_file,output_file);

%let path1 = %sysfunc(pathname(work));
%let reporttab = Arkusz1;  

proc import
datafile="&amp;amp;path1\&amp;amp;rtcf_file." out=My_lib.&amp;amp;output_file. dbms=xlsx replace;
/* datafile="&amp;amp;path1\&amp;amp;rtcf_file." out=work.&amp;amp;output_file. dbms=xlsx replace;*/
getnames=yes;
sheet="&amp;amp;reporttab.";
run;
/* to move the fimported file to archive location*/
%sysexec move "&amp;amp;path1\&amp;amp;rtcf_file." "&amp;amp;path1\Archive";


%Mend Import_StrategicFile;

data _null_;
set wash_file;
call symput ('file_date',file_date);
select (actual_file_name);
when ('AAAA') rc=dosubl('%Import_StrategicFile(AAAA_&amp;amp;file_date.,HI_AAAA)'); /* doing pro import to same library*/
when ('BBBB') rc=dosubl('%Import_StrategicFile(BBBB_&amp;amp;file_date.,BBBB)'); /* doing pro import to same library*/
when ('CCCC') rc=dosubl('%Import_StrategicFile(CCCC_&amp;amp;file_date.,CCCC)'); /* doing pro import to same library*/
otherwise put=hi;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have nice and clear log without errors:&lt;/P&gt;
&lt;PRE&gt;1    libname My_lib (work);
NOTE: Libref MY_LIB was successfully assigned as follows:
      Levels:           1
      Engine(1):        V9
      Physical Name(1): R:\_TD32_YABWON700_
2
3    data wash_file;
4      actual_file_name = 'AAAA'; file_date= "X.xlsx"; output;
5      actual_file_name = 'BBBB'; file_date= "X.xlsx"; output;
6      actual_file_name = 'CCCC'; file_date= "X.xlsx"; output;
7    run;

NOTE: The data set WORK.WASH_FILE has 3 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds


8
9
10
11
12   %Macro Import_StrategicFile(rtcf_file,output_file);
13
14   %let path1 = %sysfunc(pathname(work));
15   %let reporttab = Arkusz1;
16
17   proc import
18   datafile="&amp;amp;path1\&amp;amp;rtcf_file." out=My_lib.&amp;amp;output_file. dbms=xlsx replace;
19   /* datafile="&amp;amp;path1\&amp;amp;rtcf_file." out=work.&amp;amp;output_file. dbms=xlsx replace;*/
20   getnames=yes;
21   sheet="&amp;amp;reporttab.";
22   run;
23   /* to move the fimported file to archive location*/
24   %sysexec move "&amp;amp;path1\&amp;amp;rtcf_file." "&amp;amp;path1\Archive";
25
26
27   %Mend Import_StrategicFile;
28
29   data _null_;
30   set wash_file;
31   call symput ('file_date',file_date);
32   select (actual_file_name);
33   when ('AAAA') rc=dosubl('%Import_StrategicFile(AAAA_&amp;amp;file_date.,HI_AAAA)'); /* doing pro import to same library*/
34   when ('BBBB') rc=dosubl('%Import_StrategicFile(BBBB_&amp;amp;file_date.,BBBB)'); /* doing pro import to same library*/
35   when ('CCCC') rc=dosubl('%Import_StrategicFile(CCCC_&amp;amp;file_date.,CCCC)'); /* doing pro import to same library*/
36   otherwise put=hi;
37   end;
38   run;

NOTE: Variable hi is uninitialized.
NOTE: The import data set has 2 observations and 3 variables.
NOTE: MY_LIB.HI_AAAA data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


NOTE: The import data set has 2 observations and 3 variables.
NOTE: MY_LIB.BBBB data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


NOTE: The import data set has 2 observations and 3 variables.
NOTE: MY_LIB.CCCC data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


NOTE: There were 3 observations read from the data set WORK.WASH_FILE.
NOTE: DATA statement used (Total process time):
      real time           4.80 seconds
      cpu time            0.89 seconds&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) are there any other assumptions about your data we don't know?&lt;/P&gt;
&lt;P&gt;2) your datastep has issues: `NOTE: Variable hi is uninitialized`&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) are your input data ok?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 10:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647026#M193599</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-05-12T10:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Lock Error on SAS Dataset Library  when executing multiple PROC import simultaneously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647029#M193600</link>
      <description>&lt;P&gt;i am lost&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;did you mean || strip(file_date) || rather than  !! strip(file_date) !!&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 12 May 2020 10:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647029#M193600</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2020-05-12T10:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Lock Error on SAS Dataset Library  when executing multiple PROC import simultaneously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647031#M193601</link>
      <description>&lt;P&gt;thanks the code is working for me as well .. I don't know why it showed a lock&amp;nbsp; the first time&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 10:17:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647031#M193601</guid>
      <dc:creator>dennis_oz</dc:creator>
      <dc:date>2020-05-12T10:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Lock Error on SAS Dataset Library  when executing multiple PROC import simultaneously</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647032#M193602</link>
      <description>&lt;P&gt;The double exclamation signs are syntactically equivalent to the double pipe character.&lt;/P&gt;
&lt;P&gt;But as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;demonstrated, the other method will also work, but I prefer to use macro elements only when absolutely needed.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 10:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lock-Error-on-SAS-Dataset-Library-when-executing-multiple-PROC/m-p/647032#M193602</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-12T10:18:12Z</dc:date>
    </item>
  </channel>
</rss>

