<?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: Looping through passing parameters in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-through-passing-parameters/m-p/536448#M33075</link>
    <description>&lt;P&gt;You do this in two steps. The first one reads the filenames into a dataset, while the second one uses that dataset to dynamically open the files and read them:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename indata pipe 'dir /sas/sasconfig/Lev1/SASApp/WorkspaceServer/Logs /b';

data file_list;
 length fname $128;
 infile indata truncover; /* infile statement for file names */
 input fname $128.; /* read the file names from the directory */
run;

data
  x_wo_step (keep=fname text ds_name ds_count real_time)
  w_step (keep=fname ds_name step_used)
  x_step (keep=fname ds_name memory)
  project_name (keep=fname ds_name proj_name)
;
set file_list;
do until (eof);
  infile dummy filevar=fname truncover end=eof;
  input text $1000. ;
  if findw(text,"NOTE: The data set", ' ', 'E') eq 1 then do;
    ds_name = scan(text,5," ");
    ds_count = scan(text,7," ");
    output x_wo_step;
  end;
  else if findw(text,"NOTE: Table", ' ', 'E') eq 1 then do;
    ds_name = scan(text,3," ");
    ds_count = scan(text,6," ");
    output x_wo_step;
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Add code for what you want in w_step, x_step and project_name.&lt;/P&gt;
&lt;P&gt;Note that your checks for findw were off (the NOTEs always appear in position 1) and the second arguments for the scan() function calls are different.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Feb 2019 12:23:44 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-02-18T12:23:44Z</dc:date>
    <item>
      <title>Looping through passing parameters</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-through-passing-parameters/m-p/536394#M33069</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new in SAS and need some help.&lt;/P&gt;&lt;P&gt;I wrote code which parses log and stores result in dataset. However, there are multiple logs, and I need them to be passed to the code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Infile should accept log names dynamically from file_list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;filename indata pipe 'dir /sas/sasconfig/Lev1/SASApp/WorkspaceServer/Logs /b';
data file_list;
 length fname $128;
 infile indata truncover; /* infile statement for file names */
 input fname $128.; /* read the file names from the directory */
 call symput ('num_files',_n_); /* store the record number in a macro variable */
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro csss;
data x_wo_step(keep= text ds_name ds_count real_time) w_step(keep=ds_name step_used) x_step(keep=ds_name memory) project_name(keep=ds_name proj_name);
infile "/sas/sasconfig/Lev1/SASApp/WorkspaceServer/Logs/SASMain_WorkspaceServer_2019-02-17_08:00_65658_pussurmanov.log" truncover end=eof;
input text $1000. ;
retain ds_name ds_count ;

if findw(text,"NOTE: The data set", ' ', 'E') eq 6 then do;
ds_name = scan(text,10," ");
ds_count = scan(text,12," ");
output x_wo_step;
end;

else if findw(text,"NOTE: Table", ' ', 'E') eq 6 then do;
ds_name = scan(text,8," ");
ds_count = scan(text,11," ");
output x_wo_step;
end;&lt;/PRE&gt;&lt;P&gt;............&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 09:12:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-through-passing-parameters/m-p/536394#M33069</guid>
      <dc:creator>oljasomar</dc:creator>
      <dc:date>2019-02-18T09:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Looping through passing parameters</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-through-passing-parameters/m-p/536448#M33075</link>
      <description>&lt;P&gt;You do this in two steps. The first one reads the filenames into a dataset, while the second one uses that dataset to dynamically open the files and read them:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename indata pipe 'dir /sas/sasconfig/Lev1/SASApp/WorkspaceServer/Logs /b';

data file_list;
 length fname $128;
 infile indata truncover; /* infile statement for file names */
 input fname $128.; /* read the file names from the directory */
run;

data
  x_wo_step (keep=fname text ds_name ds_count real_time)
  w_step (keep=fname ds_name step_used)
  x_step (keep=fname ds_name memory)
  project_name (keep=fname ds_name proj_name)
;
set file_list;
do until (eof);
  infile dummy filevar=fname truncover end=eof;
  input text $1000. ;
  if findw(text,"NOTE: The data set", ' ', 'E') eq 1 then do;
    ds_name = scan(text,5," ");
    ds_count = scan(text,7," ");
    output x_wo_step;
  end;
  else if findw(text,"NOTE: Table", ' ', 'E') eq 1 then do;
    ds_name = scan(text,3," ");
    ds_count = scan(text,6," ");
    output x_wo_step;
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Add code for what you want in w_step, x_step and project_name.&lt;/P&gt;
&lt;P&gt;Note that your checks for findw were off (the NOTEs always appear in position 1) and the second arguments for the scan() function calls are different.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 12:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Looping-through-passing-parameters/m-p/536448#M33075</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-18T12:23:44Z</dc:date>
    </item>
  </channel>
</rss>

