<?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: How to create a List from PROC COMPARE to use in program in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229269#M54380</link>
    <description>&lt;P&gt;Not sure I follow you, but my take is you want to drop variables which only appear in one yes, if so:&lt;/P&gt;
&lt;PRE&gt;proc sql noprint; 
  select  distinct NAME
  into    :DROP_LIST separated by " "
  from    (select NAME from DICTIONARY.COLUMNS where LIBNAME="SASHELP" and MEMNAME="CARS")
  where   NAME not in (select NAME from DICTIONARY.COLUMNS where LIBNAME="SASHELP" and MEMNAME="CLASS"); 
quit;
%put &amp;amp;DROP_LIST.;&lt;/PRE&gt;
&lt;P&gt;This is just a general example. &amp;nbsp;Please provide test data in the form of datasteps, and required output if you require something more specific.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Oct 2015 12:51:03 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-10-09T12:51:03Z</dc:date>
    <item>
      <title>How to create a List from PROC COMPARE to use in program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229258#M54376</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know that I have read something on how to do this, but after much searching yesterday - I am finally asking here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a listing of variables from a PROC COMPARE of two datasets.&amp;nbsp; And after capturing just the variables use them as a %LET statement to put in for a DROP= statment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can do the PROC COMPARE and get the list of variables.&amp;nbsp; But I had to cut and paste them into my program for the %let.&amp;nbsp; There are over 50 variables that show up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options nodate pageno=1 linesize=80 pagesize=40;
proc compare base=sas14.aug14sup
compare=sas15.aug15sup out=work.temp
novalues brief listvar;
id var;
title 'Comparison of Variables in 2 Different Data Sets';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone give me a better way of programming this, without the cut and paste step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much for any help here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nancy&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 12:27:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229258#M54376</guid>
      <dc:creator>SASHunter</dc:creator>
      <dc:date>2015-10-09T12:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a List from PROC COMPARE to use in program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229259#M54377</link>
      <description>&lt;P&gt;I don't know where that Title came from - That is not what I entered. ??? : \&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 12:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229259#M54377</guid>
      <dc:creator>SASHunter</dc:creator>
      <dc:date>2015-10-09T12:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a List from PROC COMPARE to use in program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229260#M54378</link>
      <description>I corrected the title.  Perhaps an "autocomplete" from the Post Message form?</description>
      <pubDate>Fri, 09 Oct 2015 12:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229260#M54378</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2015-10-09T12:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a List from PROC COMPARE to use in program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229269#M54380</link>
      <description>&lt;P&gt;Not sure I follow you, but my take is you want to drop variables which only appear in one yes, if so:&lt;/P&gt;
&lt;PRE&gt;proc sql noprint; 
  select  distinct NAME
  into    :DROP_LIST separated by " "
  from    (select NAME from DICTIONARY.COLUMNS where LIBNAME="SASHELP" and MEMNAME="CARS")
  where   NAME not in (select NAME from DICTIONARY.COLUMNS where LIBNAME="SASHELP" and MEMNAME="CLASS"); 
quit;
%put &amp;amp;DROP_LIST.;&lt;/PRE&gt;
&lt;P&gt;This is just a general example. &amp;nbsp;Please provide test data in the form of datasteps, and required output if you require something more specific.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 12:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229269#M54380</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-10-09T12:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a List from PROC COMPARE to use in program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229329#M54383</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname sas14 '.../prod/sas/aug14';&lt;BR /&gt;libname sas15 '.../prod/sas/aug15';&lt;BR /&gt;&lt;BR /&gt;PROC SQL;
   SELECT distinct NAME
   into     :DROP_LIST separated by " "
   from   (select NAME from DICTIONARY.COLUMNS where upcase(libname)="SAS14" and upcase(MEMNAME)="AUG14SUP")
   where  NAME not in (select NAME from DICTIONARY.COLUMNS where upcase(libname)="SAS15"
                and upcase(MEMNAME)="AUG15SUP");
 QUIT;
 %PUT &amp;amp;DROP_LIST.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I &lt;U&gt;can not&lt;/U&gt; get the above to work for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do the following I get a listing for the variables in 'aug14sup' just fine.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;[code]&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options nodate pageno=1 source linesize=80 pagesize=60;&lt;BR /&gt;
libname sas14 '/cpspb/prod/sas/aug';&lt;BR /&gt;%global drop_list;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;   describe table dictionary.members;&lt;BR /&gt;   title 'SAS Files in SAS14 Library';&lt;BR /&gt;  select memname, memtype&lt;BR /&gt;    from dictionary.members&lt;BR /&gt;    where libname='SAS14';&lt;BR /&gt; QUIT;&lt;BR /&gt;&lt;BR /&gt;title " ";&lt;BR /&gt;PROC SQL;&lt;BR /&gt;   SELECT distinct NAME&lt;BR /&gt;     into    :DROP_LIST separated by " "&lt;BR /&gt;     from DICTIONARY.COLUMNS&lt;BR /&gt;     where upcase(LIBNAME)='SAS14' and upcase(MEMNAME)='AUG14SUP';&lt;BR /&gt;QUIT;&lt;BR /&gt;%put %DROP_LIST;   &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;[/code]&lt;/P&gt;&lt;P&gt;But if I try to combine the two libraries and the datasets using your example I get nothing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually I get - NOTE:&amp;nbsp; No rows were selected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 17:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229329#M54383</guid>
      <dc:creator>SASHunter</dc:creator>
      <dc:date>2015-10-09T17:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a List from PROC COMPARE to use in program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229699#M54419</link>
      <description>&lt;P&gt;I finally got this to work, by using the UPCASE in front of the LIBNAME statement as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
   select distinct NAME
      into :dupvars separated by " "
   from (select NAME from DICTIONARY.COLUMNS where
         upcase(libname)="SAS15" and upcase(MEMNAME)='AUG15SUP')
   where NAME not in (select NAME from DICTIONARY.COLUMNS
       where upcase(libname)="SAS14" and
             upcase(MEMNAME)="AUG14SUP");
quit;
%put &amp;amp;dupvars;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now - can I use that new &amp;amp;dupvars file in a program to drop these variables in a KEEP statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I view the listing it has 'Column Name' above it, so I'm not sure if that would work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nancy&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 13:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229699#M54419</guid>
      <dc:creator>SASHunter</dc:creator>
      <dc:date>2015-10-13T13:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a List from PROC COMPARE to use in program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229883#M54434</link>
      <description>&lt;P&gt;I think this is what you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options center=0 ls=max;
filename FT74F001 temp;
proc printto new print=FT74F001;
   run;
proc compare base=sashelp.shoes(obs=5) compare=sashelp.shoes(firstobs=2 obs=6) brief novalues listvar;
   run;
proc printto;
   run;
data unequalvars;
   infile FT74F001;
   input @'NOTE: Values of the following' n @'variables compare unequal:' @;
   do i = 1 to n;
      input name:$32. @;
      output;
      end;
   stop;
   run;

proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/490iD4A3FCE9A71676D3/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2015 13:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-create-a-List-from-PROC-COMPARE-to-use-in-program/m-p/229883#M54434</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-10-14T13:01:52Z</dc:date>
    </item>
  </channel>
</rss>

