<?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: Proc SQL ? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL/m-p/70759#M20371</link>
    <description>Thanks!  This is just what I needed. I'll also look into the diagnostics that you mention for Proc MI.  Our data set is quite challenging, but if all works out the results will be very useful.</description>
    <pubDate>Wed, 08 Sep 2010 21:23:36 GMT</pubDate>
    <dc:creator>bg</dc:creator>
    <dc:date>2010-09-08T21:23:36Z</dc:date>
    <item>
      <title>Proc SQL ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL/m-p/70757#M20369</link>
      <description>I have two versions of the same data set..same variable names, Data set A1 has missing values, Data set A2 has missing values filled in.  I need to produce a third data set, A3 which has contains only the "filled in" values from data set A2 and missing values in all other spaces. For example I need to produce A3 as follows&lt;BR /&gt;
Data set A1                                                  &lt;BR /&gt;
X1  X2 X3                     &lt;BR /&gt;
1   10  20                                                       &lt;BR /&gt;
.    11   .                                                      &lt;BR /&gt;
3     .   22                                                     &lt;BR /&gt;
&lt;BR /&gt;
Data Set A2&lt;BR /&gt;
X1   X2  X3  &lt;BR /&gt;
1   10   20 &lt;BR /&gt;
 2   11   21  &lt;BR /&gt;
3    12   22 &lt;BR /&gt;
&lt;BR /&gt;
Data Set A3&lt;BR /&gt;
X1   X2   X3&lt;BR /&gt;
.      ,     .&lt;BR /&gt;
 2      .     21&lt;BR /&gt;
 .      12     .&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
                                 &lt;BR /&gt;
 Is there a way to do this using Proc SQL or any other ideas?   Thanks for any suggestions.&lt;BR /&gt;
&lt;BR /&gt;
PS I'm using PROC MI to create imputation data sets and I'd like to examine only the values that have been imputed for each variable.  In my actual data set I have about 300 variables for which I need to compute original values and only the imputed values.</description>
      <pubDate>Wed, 08 Sep 2010 17:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL/m-p/70757#M20369</guid>
      <dc:creator>bg</dc:creator>
      <dc:date>2010-09-08T17:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL/m-p/70758#M20370</link>
      <description>Here is a DATA step that will give you the requested data set.  Be sure to examine the diagnostics for MI they can give you good insight into how well the values were imputed.&lt;BR /&gt;
[pre]Data A1 ;&lt;BR /&gt;
input X1 X2 X3 ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1 10 20 &lt;BR /&gt;
. 11 . &lt;BR /&gt;
3 . 22 &lt;BR /&gt;
run;&lt;BR /&gt;
Data A2;&lt;BR /&gt;
input X1 X2 X3;&lt;BR /&gt;
datalines; &lt;BR /&gt;
1 10 20 &lt;BR /&gt;
2 11 21 &lt;BR /&gt;
3 12 22 &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data a3(keep=x:);&lt;BR /&gt;
   array yy {9999} _temporary_;&lt;BR /&gt;
      set a2;&lt;BR /&gt;
      array xx {*} x:;   &lt;BR /&gt;
      do i = 1 to dim(xx);&lt;BR /&gt;
            yy{i} = xx{i};&lt;BR /&gt;
      end;&lt;BR /&gt;
      set a1;&lt;BR /&gt;
      do i = 1 to dim(xx);&lt;BR /&gt;
         if xx{i}=yy{i} then xx{i}=.;&lt;BR /&gt;
         else xx{i} = yy{i};&lt;BR /&gt;
      end;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print data=a3;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
This solution makes quite a few assumptions about the accuracy of the problem description.  Adjustments to reality can be made using the macro language and other techniques.</description>
      <pubDate>Wed, 08 Sep 2010 20:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL/m-p/70758#M20370</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-09-08T20:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL/m-p/70759#M20371</link>
      <description>Thanks!  This is just what I needed. I'll also look into the diagnostics that you mention for Proc MI.  Our data set is quite challenging, but if all works out the results will be very useful.</description>
      <pubDate>Wed, 08 Sep 2010 21:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL/m-p/70759#M20371</guid>
      <dc:creator>bg</dc:creator>
      <dc:date>2010-09-08T21:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL/m-p/70760#M20372</link>
      <description>Hi.I also find a method to get that.&lt;BR /&gt;
And also hope someone can use proc sql to get it.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
Data A1 ;&lt;BR /&gt;
input X1 X2 X3 ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1 10 20 &lt;BR /&gt;
. 11 . &lt;BR /&gt;
3 . 22 &lt;BR /&gt;
run;&lt;BR /&gt;
Data A2;&lt;BR /&gt;
input X1 X2 X3;&lt;BR /&gt;
datalines; &lt;BR /&gt;
1 10 20 &lt;BR /&gt;
2 11 21 &lt;BR /&gt;
3 12 22 &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data a1;&lt;BR /&gt;
  set a1;&lt;BR /&gt;
  id+1;*just to success to merge two datasets;&lt;BR /&gt;
run;&lt;BR /&gt;
data a2;&lt;BR /&gt;
  set a2;&lt;BR /&gt;
  id+1;*just to success to merge two datasets;&lt;BR /&gt;
run;&lt;BR /&gt;
data temp;&lt;BR /&gt;
 set a1;&lt;BR /&gt;
  array x{*} x: ;&lt;BR /&gt;
  do i=1 to dim(x);&lt;BR /&gt;
   if not missing(x{i}) then x{i}=9999;*whatever you want,but not the same with your data value. it is just to flag;&lt;BR /&gt;
  end;     &lt;BR /&gt;
  drop i;&lt;BR /&gt;
run;&lt;BR /&gt;
data tmp;&lt;BR /&gt;
 update a2 temp;&lt;BR /&gt;
 by id ;&lt;BR /&gt;
run;&lt;BR /&gt;
data result;&lt;BR /&gt;
 set tmp(drop=id);&lt;BR /&gt;
 array x{*} x: ;&lt;BR /&gt;
 do i=1 to dim(x);&lt;BR /&gt;
  if x{i}=9999 then call missing(x{i});&lt;BR /&gt;
 end;&lt;BR /&gt;
 drop i;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
 [/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Fri, 10 Sep 2010 01:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-SQL/m-p/70760#M20372</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-09-10T01:25:47Z</dc:date>
    </item>
  </channel>
</rss>

