<?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 Replacing observations in a dataset with values from another dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replacing-observations-in-a-dataset-with-values-from-another/m-p/82514#M17798</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dataset A that contains one observation and one variable (NMaxBlocks).&amp;nbsp; I created dataset C by joining datasetA with datasetB, and dataset B did not contain the variable NMaxBlocks.&amp;nbsp; Because B did not originally contain the variable NMaxBlocks, all observations in C that were originally in B now contain "." for the variable NMaxBlocks.&amp;nbsp; I want all observations in C that contain "." because they were originally part of B to contain the value for NMaxBlocks that originally appeared in A. (See attached exerpt of output from C- all "." in NMaxBlocks need to contain 4 from NMAxBlocks in the last observation in the dataset).&amp;nbsp; I know there is a simple way to do this, but I am not enough of an experienced SAS user to know how to do this yet.&amp;nbsp; Any ideas?&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11195iDCB3BD5B1E4100B3/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Nov 2012 21:28:31 GMT</pubDate>
    <dc:creator>fastb</dc:creator>
    <dc:date>2012-11-27T21:28:31Z</dc:date>
    <item>
      <title>Replacing observations in a dataset with values from another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-observations-in-a-dataset-with-values-from-another/m-p/82514#M17798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a dataset A that contains one observation and one variable (NMaxBlocks).&amp;nbsp; I created dataset C by joining datasetA with datasetB, and dataset B did not contain the variable NMaxBlocks.&amp;nbsp; Because B did not originally contain the variable NMaxBlocks, all observations in C that were originally in B now contain "." for the variable NMaxBlocks.&amp;nbsp; I want all observations in C that contain "." because they were originally part of B to contain the value for NMaxBlocks that originally appeared in A. (See attached exerpt of output from C- all "." in NMaxBlocks need to contain 4 from NMAxBlocks in the last observation in the dataset).&amp;nbsp; I know there is a simple way to do this, but I am not enough of an experienced SAS user to know how to do this yet.&amp;nbsp; Any ideas?&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11195iDCB3BD5B1E4100B3/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 21:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-observations-in-a-dataset-with-values-from-another/m-p/82514#M17798</guid>
      <dc:creator>fastb</dc:creator>
      <dc:date>2012-11-27T21:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing observations in a dataset with values from another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-observations-in-a-dataset-with-values-from-another/m-p/82515#M17799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are several ways to accomplish this, here's one using multiple SET statements within a DATA step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WORK.C ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF _N_ = 1 THEN SET WORK.A ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SET WORK.B&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;RUN ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 22:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-observations-in-a-dataset-with-values-from-another/m-p/82515#M17799</guid>
      <dc:creator>KoMartin66</dc:creator>
      <dc:date>2012-11-27T22:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing observations in a dataset with values from another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-observations-in-a-dataset-with-values-from-another/m-p/82516#M17800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps you would be better off learning how to combine A and B, rather than fixing the problem later.&amp;nbsp; If you are using a DATA step, it would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data C;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if _n_=1 then set A;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set B;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using SQL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; create table C as select * from A, B;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would no longer have that single observation at the end, where the contents of A matches nothing from B.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 22:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-observations-in-a-dataset-with-values-from-another/m-p/82516#M17800</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-11-27T22:10:37Z</dc:date>
    </item>
  </channel>
</rss>

