<?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 Bringing in multiple datasets from one library into another using a macro in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822322#M34975</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am connecting to my Oracle SQL schema using SAS Enterprise Guide. Once I have my SQL datasets into SAS (total of 8 datasets), I want to call all the datasets, individually, into the Work library.&amp;nbsp;I am writing the code below to bring in one dataset into Work library at a time:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA WORK.DATASET_1;&lt;BR /&gt;SET MYSQL.DATASET_1;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA WORK.DATASET_2;&lt;BR /&gt;SET MYSQL.DATASET_2;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;DATA WORK.DATASET_8;&lt;BR /&gt;SET MYSQL.DATASET_8;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the following macro:&lt;/P&gt;&lt;P&gt;%MACRO ST (DS);&lt;BR /&gt;PROC SORT DATA = MYSQL.&amp;amp;DS OUT=WORK.&amp;amp;DS;&lt;BR /&gt;BY PRIMARY_ID;&lt;BR /&gt;RUN;&lt;BR /&gt;%MEND;&lt;BR /&gt;%ST(DATASET_1);&lt;BR /&gt;%ST(DATASET_2);&lt;BR /&gt;%ST(DATASET_3);&lt;BR /&gt;%ST(DATASET_4);&lt;BR /&gt;%ST(DATASET_5);&lt;BR /&gt;%ST(DATASET_6);&lt;BR /&gt;%ST(DATASET_7);&lt;BR /&gt;%ST(DATASET_8);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This takes a very long to run as the datasets are large and they are being sorted. Is there a way to bring in the datasets into Work library (individual datasets) using a macro without using proc sort?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jul 2022 17:44:53 GMT</pubDate>
    <dc:creator>skhan9</dc:creator>
    <dc:date>2022-07-08T17:44:53Z</dc:date>
    <item>
      <title>Bringing in multiple datasets from one library into another using a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822322#M34975</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am connecting to my Oracle SQL schema using SAS Enterprise Guide. Once I have my SQL datasets into SAS (total of 8 datasets), I want to call all the datasets, individually, into the Work library.&amp;nbsp;I am writing the code below to bring in one dataset into Work library at a time:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA WORK.DATASET_1;&lt;BR /&gt;SET MYSQL.DATASET_1;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA WORK.DATASET_2;&lt;BR /&gt;SET MYSQL.DATASET_2;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;DATA WORK.DATASET_8;&lt;BR /&gt;SET MYSQL.DATASET_8;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the following macro:&lt;/P&gt;&lt;P&gt;%MACRO ST (DS);&lt;BR /&gt;PROC SORT DATA = MYSQL.&amp;amp;DS OUT=WORK.&amp;amp;DS;&lt;BR /&gt;BY PRIMARY_ID;&lt;BR /&gt;RUN;&lt;BR /&gt;%MEND;&lt;BR /&gt;%ST(DATASET_1);&lt;BR /&gt;%ST(DATASET_2);&lt;BR /&gt;%ST(DATASET_3);&lt;BR /&gt;%ST(DATASET_4);&lt;BR /&gt;%ST(DATASET_5);&lt;BR /&gt;%ST(DATASET_6);&lt;BR /&gt;%ST(DATASET_7);&lt;BR /&gt;%ST(DATASET_8);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This takes a very long to run as the datasets are large and they are being sorted. Is there a way to bring in the datasets into Work library (individual datasets) using a macro without using proc sort?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 17:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822322#M34975</guid>
      <dc:creator>skhan9</dc:creator>
      <dc:date>2022-07-08T17:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Bringing in multiple datasets from one library into another using a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822323#M34976</link>
      <description>&lt;P&gt;You can copy them in bulk using PROC COPY. Try something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC COPY IN=MYSQL OUT=WORK;
&amp;nbsp; &amp;nbsp;/* List the name of each table you want to copy to WORK */&amp;nbsp;
&amp;nbsp; &amp;nbsp;SELECT DATASET1 DATASET2 DATASET2 DATASET 4;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Alternatively, you could just access the tables directly in Oracle in your SAS program without copying them out first. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;May the SAS be with you!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&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>Fri, 08 Jul 2022 17:51:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822323#M34976</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2022-07-08T17:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Bringing in multiple datasets from one library into another using a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822326#M34977</link>
      <description>&lt;P&gt;Maybe you could do the sorting when you issue the SQL call to Oracle, I would imagine it might be faster in Oracle than in SAS data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then combine them all via this code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set mysql.dataset:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note the colon after DATASET&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 17:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822326#M34977</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-08T17:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bringing in multiple datasets from one library into another using a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822327#M34978</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=mysql; *input library;
copy out=work;*output library;
select dataset_1-dataset_8;
run;quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use PROC DATASETS or PROC COPY instead. No need for macros or data steps.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p19ugnx9u6hi6xn1t1gsiyg6l3ag.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p19ugnx9u6hi6xn1t1gsiyg6l3ag.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/358133"&gt;@skhan9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am connecting to my Oracle SQL schema using SAS Enterprise Guide. Once I have my SQL datasets into SAS (total of 8 datasets), I want to call all the datasets, individually, into the Work library.&amp;nbsp;I am writing the code below to bring in one dataset into Work library at a time:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA WORK.DATASET_1;&lt;BR /&gt;SET MYSQL.DATASET_1;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA WORK.DATASET_2;&lt;BR /&gt;SET MYSQL.DATASET_2;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;DATA WORK.DATASET_8;&lt;BR /&gt;SET MYSQL.DATASET_8;&amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried the following macro:&lt;/P&gt;
&lt;P&gt;%MACRO ST (DS);&lt;BR /&gt;PROC SORT DATA = MYSQL.&amp;amp;DS OUT=WORK.&amp;amp;DS;&lt;BR /&gt;BY PRIMARY_ID;&lt;BR /&gt;RUN;&lt;BR /&gt;%MEND;&lt;BR /&gt;%ST(DATASET_1);&lt;BR /&gt;%ST(DATASET_2);&lt;BR /&gt;%ST(DATASET_3);&lt;BR /&gt;%ST(DATASET_4);&lt;BR /&gt;%ST(DATASET_5);&lt;BR /&gt;%ST(DATASET_6);&lt;BR /&gt;%ST(DATASET_7);&lt;BR /&gt;%ST(DATASET_8);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This takes a very long to run as the datasets are large and they are being sorted. Is there a way to bring in the datasets into Work library (individual datasets) using a macro without using proc sort?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 17:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822327#M34978</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-07-08T17:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Bringing in multiple datasets from one library into another using a macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822346#M34981</link>
      <description>&lt;P&gt;Thank you all for the solutions! Both, proc copy and proc dataset, work amazingly well and fast!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 19:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Bringing-in-multiple-datasets-from-one-library-into-another/m-p/822346#M34981</guid>
      <dc:creator>skhan9</dc:creator>
      <dc:date>2022-07-08T19:22:16Z</dc:date>
    </item>
  </channel>
</rss>

