<?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: Turn these datasteps into a macro or other repeated process. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Turn-these-datasteps-into-a-macro-or-other-repeated-process/m-p/685219#M24279</link>
    <description>&lt;P&gt;As the excel type is xlsx I proffered the datastep then the proc import.&lt;/P&gt;
&lt;P&gt;Please check next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year = 2017;
libname excelin xlsx "C:\PCC_Trends\PCC_&amp;amp;year..xlsx";

%macro exec(suffix);
  data work.PCC_&amp;amp;year.&amp;amp;suffix;
   set excelin.Section&amp;amp;suffix;
  run;
  
  proc sort data=work.PCC_&amp;amp;year.&amp;amp;suffix;
    by OSHPD_ID;
  run;
%mend exec;
%exec(a);
%exec(b);
%exec(c);
%exec(d);
%exec(e);
%exec(f);

data PCC_&amp;amp;year;
merge PCC_&amp;amp;year.a PCC_&amp;amp;year.b PCC_&amp;amp;year.c ;
  by OSHPD_ID;
run;

data PCC_&amp;amp;year.nonresp;
merge PCC_&amp;amp;year.d PCC_&amp;amp;year.e PCC_&amp;amp;year.f ;
  by OSHPD_ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 19 Sep 2020 20:24:12 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2020-09-19T20:24:12Z</dc:date>
    <item>
      <title>Turn these datasteps into a macro or other repeated process.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Turn-these-datasteps-into-a-macro-or-other-repeated-process/m-p/685211#M24278</link>
      <description>&lt;P&gt;I need to make this more efficient. I have 10 datasets that I want to do this same process to (e.g. 2008:2018).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make this a repeated process or macro so that the date variables are able to change. I have the 2017 example below...THANK YOU!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/***2017***/&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;IMPORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;OUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= WORK.PCC_2017a&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DATAFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"C:\PCC_Trends\PCC_2017.xlsx"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=XLSX REPLACE;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=Sectiona;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;GETNAMES&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=YES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;IMPORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;OUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= WORK.PCC_2017b&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DATAFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"C:\PCC_Trends\PCC_2017.xlsx"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=XLSX REPLACE;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=Sectionb;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;GETNAMES&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=YES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;IMPORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;OUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= WORK.PCC_2017c&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DATAFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"C:\PCC_Trends\PCC_2017.xlsx"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=XLSX REPLACE;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=Sectionc;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;GETNAMES&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=YES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;IMPORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;OUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= WORK.PCC_2017d&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DATAFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"C:\PCC_Trends\PCC_2017.xlsx"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=XLSX REPLACE;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=NonRespa;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;GETNAMES&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=YES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;IMPORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;OUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= WORK.PCC_2017e&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DATAFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"C:\PCC_Trends\PCC_2017.xlsx"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=XLSX REPLACE;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=NonRespb;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;GETNAMES&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=YES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;IMPORT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;OUT&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= WORK.PCC_2017f&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DATAFILE&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"C:\PCC_Trends\PCC_2017.xlsx"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=XLSX REPLACE;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=NonRespc;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;GETNAMES&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=YES;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=PCC_2017a; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; OSHPD_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=PCC_2017b; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; OSHPD_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=PCC_2017c; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; OSHPD_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=PCC_2017d; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; OSHPD_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=PCC_2017e; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; OSHPD_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=PCC_2017f; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; OSHPD_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; PCC_2017; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;merge&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; PCC_2017a PCC_2017b PCC_2017c ; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; OSHPD_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; PCC_2017nonresp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;merge&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; PCC_2017d PCC_2017e PCC_2017f ; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; OSHPD_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 18:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Turn-these-datasteps-into-a-macro-or-other-repeated-process/m-p/685211#M24278</guid>
      <dc:creator>erikhendrickson</dc:creator>
      <dc:date>2020-09-19T18:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Turn these datasteps into a macro or other repeated process.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Turn-these-datasteps-into-a-macro-or-other-repeated-process/m-p/685219#M24279</link>
      <description>&lt;P&gt;As the excel type is xlsx I proffered the datastep then the proc import.&lt;/P&gt;
&lt;P&gt;Please check next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year = 2017;
libname excelin xlsx "C:\PCC_Trends\PCC_&amp;amp;year..xlsx";

%macro exec(suffix);
  data work.PCC_&amp;amp;year.&amp;amp;suffix;
   set excelin.Section&amp;amp;suffix;
  run;
  
  proc sort data=work.PCC_&amp;amp;year.&amp;amp;suffix;
    by OSHPD_ID;
  run;
%mend exec;
%exec(a);
%exec(b);
%exec(c);
%exec(d);
%exec(e);
%exec(f);

data PCC_&amp;amp;year;
merge PCC_&amp;amp;year.a PCC_&amp;amp;year.b PCC_&amp;amp;year.c ;
  by OSHPD_ID;
run;

data PCC_&amp;amp;year.nonresp;
merge PCC_&amp;amp;year.d PCC_&amp;amp;year.e PCC_&amp;amp;year.f ;
  by OSHPD_ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 20:24:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Turn-these-datasteps-into-a-macro-or-other-repeated-process/m-p/685219#M24279</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-09-19T20:24:12Z</dc:date>
    </item>
  </channel>
</rss>

