<?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 concatenating and subsetting data sets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/concatenating-and-subsetting-data-sets/m-p/239880#M44196</link>
    <description>&lt;PRE&gt;data a;
input x y;
cards;
1 3
4 5
6 7
;
data b;
input x y;
cards;
1 4
4 7
8 9
;

data test;
   set a b;
   if x=1 then delete;
run;&lt;/PRE&gt;&lt;P&gt;I have a test code above. I want to know the process flow of this program. Does if statment acts separately on data sets i.e. read observation from a &amp;nbsp;and apply if stament on each observation and after finishing on a starts on b? &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Dec 2015 22:47:31 GMT</pubDate>
    <dc:creator>SAS_inquisitive</dc:creator>
    <dc:date>2015-12-17T22:47:31Z</dc:date>
    <item>
      <title>concatenating and subsetting data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenating-and-subsetting-data-sets/m-p/239880#M44196</link>
      <description>&lt;PRE&gt;data a;
input x y;
cards;
1 3
4 5
6 7
;
data b;
input x y;
cards;
1 4
4 7
8 9
;

data test;
   set a b;
   if x=1 then delete;
run;&lt;/PRE&gt;&lt;P&gt;I have a test code above. I want to know the process flow of this program. Does if statment acts separately on data sets i.e. read observation from a &amp;nbsp;and apply if stament on each observation and after finishing on a starts on b? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 22:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenating-and-subsetting-data-sets/m-p/239880#M44196</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2015-12-17T22:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: concatenating and subsetting data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenating-and-subsetting-data-sets/m-p/239884#M44199</link>
      <description>&lt;P&gt;Unless you specifically tell it to examine values from only one of the data sets then any record with a value of 1 for x will be deleted.&lt;/P&gt;
&lt;P&gt;You can use the IN dataset option to identify which dataset contributed the observation if that is needed. The IN option creates temporary variables that can be used for testing membership. The example below says to delete only if the record came from dataset b. The IN for dataset A would be completely optional for this code but provided as an example. If you are MERGEing datasets you can use code like If InA and InB ... to see if the record has contributions from both (or more than two) datasets.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   set a (in= inA)
       b (in= inB);
   if inB AND x=1 then delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 23:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenating-and-subsetting-data-sets/m-p/239884#M44199</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-12-17T23:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: concatenating and subsetting data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenating-and-subsetting-data-sets/m-p/239888#M44202</link>
      <description>&lt;P&gt;Thanks, ballardw. &amp;nbsp;The code posted above gives me desired result (it deletes from both data sets). &amp;nbsp;I don't want to create temporary variale now (just for learning purpose) . I wanted to know how the data step worked. &amp;nbsp;Since set statment in my example stacks a and b together sequentially, does "if " statement operate on each data sets sequentially. &amp;nbsp;Basically, I want to see what happned during _n_=1?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 23:28:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenating-and-subsetting-data-sets/m-p/239888#M44202</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2015-12-17T23:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: concatenating and subsetting data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenating-and-subsetting-data-sets/m-p/239891#M44205</link>
      <description>&lt;P&gt;Test it by adding N=_n_; after the SET but before the if.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And temporary variables are just that, they would not be in the output, just like _n_ isn't unless assigned to another variable that isn't dropped from the data.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 23:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenating-and-subsetting-data-sets/m-p/239891#M44205</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-12-17T23:46:46Z</dc:date>
    </item>
  </channel>
</rss>

