<?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: select list of subjects from all datasets while copying in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306244#M65457</link>
    <description>&lt;P&gt;Sorry for asking it again.&lt;/P&gt;
&lt;P&gt;after i do this step&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc datasets library=sdt;&lt;BR /&gt; copy out=sdttest;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will import my excel sheet which has subject id's and then the below?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt; set sashelp.vtable (where=(libname="sdt"));&lt;BR /&gt; call execute('proc sql;&lt;BR /&gt; delete from SDT.'||strip(memname)||'&lt;BR /&gt; where SUBJID not in (select distinct SUBJID from SUBJ);&lt;BR /&gt; quit;');&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it right?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where will my new data which has datasets with the subject id's &amp;nbsp;needed be saved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Oct 2016 10:35:02 GMT</pubDate>
    <dc:creator>vraj1</dc:creator>
    <dc:date>2016-10-21T10:35:02Z</dc:date>
    <item>
      <title>select list of subjects from all datasets while copying</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306220#M65451</link>
      <description>&lt;P&gt;i am copying all datasets like below&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;datasets&lt;/STRONG&gt; library=sdt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; copy out=sdttest;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this i have a excel sheet with list of subjects and i only want those subjects copied in all the datasets from sdt.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me in this&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 09:05:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306220#M65451</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-10-21T09:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: select list of subjects from all datasets while copying</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306223#M65453</link>
      <description>Use call execute in a data step that is reading your Excel.</description>
      <pubDate>Fri, 21 Oct 2016 09:13:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306223#M65453</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-10-21T09:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: select list of subjects from all datasets while copying</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306224#M65454</link>
      <description>&lt;P&gt;Can you please give an example how can i use it in my case.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 09:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306224#M65454</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-10-21T09:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: select list of subjects from all datasets while copying</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306228#M65455</link>
      <description>&lt;P&gt;Say you have all your data after this copy in sdt and in work a dataset of your subjects called subj:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vtable (where=(libname="SDT"));
  call execute('proc sql;
                  delete from SDT.'||strip(memname)||'
                  where SUBJID not in (select distinct SUBJID from SUBJ);
                quit;');
run;&lt;/PRE&gt;
&lt;P&gt;This will generate a delete step for each of the dasets in SDT.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 09:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306228#M65455</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-21T09:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: select list of subjects from all datasets while copying</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306244#M65457</link>
      <description>&lt;P&gt;Sorry for asking it again.&lt;/P&gt;
&lt;P&gt;after i do this step&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc datasets library=sdt;&lt;BR /&gt; copy out=sdttest;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will import my excel sheet which has subject id's and then the below?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt; set sashelp.vtable (where=(libname="sdt"));&lt;BR /&gt; call execute('proc sql;&lt;BR /&gt; delete from SDT.'||strip(memname)||'&lt;BR /&gt; where SUBJID not in (select distinct SUBJID from SUBJ);&lt;BR /&gt; quit;');&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it right?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where will my new data which has datasets with the subject id's &amp;nbsp;needed be saved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 10:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306244#M65457</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-10-21T10:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: select list of subjects from all datasets while copying</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306250#M65459</link>
      <description>&lt;P&gt;For each datsset you have to process, as stored in sdt, this bit of code will be generated:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc sql;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;delete from SDT.&amp;lt;dataset&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;where SUBJID not in (select distinct SUBJID from SUBJ);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Where dataset is replaced each time by the current dataset. &amp;nbsp;The proc sql will remove from that dataset any subjectid records which are not in the list you imported from Excel - and stored in a dataset SUBJ.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So the original datasets get upated in place. &amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 11:17:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306250#M65459</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-21T11:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: select list of subjects from all datasets while copying</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306267#M65468</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9﻿&lt;/a&gt;&amp;nbsp;Wouldn't it be more efficient to copy the data sets and select the subjects of interest in one SQL or DATA step than to copy all subjects&amp;nbsp;and delete in a second step?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 12:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306267#M65468</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-10-21T12:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: select list of subjects from all datasets while copying</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306271#M65471</link>
      <description>&lt;P&gt;I am not copying anything? &amp;nbsp;It simply generates a delete from step for each of the datasets. &amp;nbsp;So he has a series of files in one libname, and for each of those, the ones in the subset from Excel get removed. &amp;nbsp;No copying.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 12:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306271#M65471</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-21T12:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: select list of subjects from all datasets while copying</title>
      <link>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306272#M65472</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9﻿&lt;/a&gt;&amp;nbsp;You may not be copying but &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1﻿&lt;/a&gt;&amp;nbsp;is that is the first step "he" shows.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 12:57:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/select-list-of-subjects-from-all-datasets-while-copying/m-p/306272#M65472</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-10-21T12:57:37Z</dc:date>
    </item>
  </channel>
</rss>

