<?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 Passing a variable to another dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34817#M6876</link>
    <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I have 3 sas datasets : A,B, &amp;amp; C.&lt;BR /&gt;
I want to merge A and B to create D.  While in D, i would like to check the value of a variable from C.&lt;BR /&gt;
&lt;BR /&gt;
DATA D;&lt;BR /&gt;
MERGE A (IN=IN_A)&lt;BR /&gt;
             B (IN=IN_B);&lt;BR /&gt;
BY EID;&lt;BR /&gt;
&lt;BR /&gt;
IF IN_A AND IN_B THEN DO;&lt;BR /&gt;
    IF START_SW = " " THEN&lt;BR /&gt;
        CNT = CNT + 1;&lt;BR /&gt;
*do more*&lt;BR /&gt;
&lt;BR /&gt;
The If statement is not reconizing the variable START_SW, which is defined in Data C.  How do I pass Start_sw to dataset D?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any input!!&lt;BR /&gt;
Kevin</description>
    <pubDate>Mon, 28 Jul 2008 22:42:09 GMT</pubDate>
    <dc:creator>KevinC_</dc:creator>
    <dc:date>2008-07-28T22:42:09Z</dc:date>
    <item>
      <title>Passing a variable to another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34817#M6876</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I have 3 sas datasets : A,B, &amp;amp; C.&lt;BR /&gt;
I want to merge A and B to create D.  While in D, i would like to check the value of a variable from C.&lt;BR /&gt;
&lt;BR /&gt;
DATA D;&lt;BR /&gt;
MERGE A (IN=IN_A)&lt;BR /&gt;
             B (IN=IN_B);&lt;BR /&gt;
BY EID;&lt;BR /&gt;
&lt;BR /&gt;
IF IN_A AND IN_B THEN DO;&lt;BR /&gt;
    IF START_SW = " " THEN&lt;BR /&gt;
        CNT = CNT + 1;&lt;BR /&gt;
*do more*&lt;BR /&gt;
&lt;BR /&gt;
The If statement is not reconizing the variable START_SW, which is defined in Data C.  How do I pass Start_sw to dataset D?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any input!!&lt;BR /&gt;
Kevin</description>
      <pubDate>Mon, 28 Jul 2008 22:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34817#M6876</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2008-07-28T22:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a variable to another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34818#M6877</link>
      <description>You would get most effective feedback by sending the diagnostic output from your SASLOG to include a PUTLOG _ALL_;  command revealing all variable values.   Any other feedback is a virtual crap-shoot, especially given that we don't know what your input WORK.A and WORK.B variable values contains with each DATA step pass.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 29 Jul 2008 05:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34818#M6877</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-07-29T05:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a variable to another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34819#M6878</link>
      <description>thnx for your reply sbb.&lt;BR /&gt;
I used PUTLOG _all_ to see the values of all.  &lt;BR /&gt;
&lt;BR /&gt;
the value of the variable I need is blank.  &lt;BR /&gt;
Let me ask a basic/stupid question: Can you pass a variable from one dataset X to another dataset Y without reading X?&lt;BR /&gt;
&lt;BR /&gt;
If the answer is NO, then that's the problem I m facing.&lt;BR /&gt;
I am merging 2 datasets (A &amp;amp; B) to create C.  While I m in C, I need to access the variable from X.  X contains only on row of data.  If I use set to read X it would screw up  my merge.  Because the 2 files I am merging (A &amp;amp; B) contain multiple rows.  The merge would stop after reading just one row.  I hope I am explaining my problem clearly.&lt;BR /&gt;
&lt;BR /&gt;
help please! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 29 Jul 2008 15:15:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34819#M6878</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2008-07-29T15:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a variable to another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34820#M6879</link>
      <description>From your recent post, you gave some indication that there is only one row and variable/column you wish to pass to another DATA step.  So, yes, you can use CALL SYMPUT in "data step #1" to generate a SAS macro variable.  &lt;BR /&gt;
&lt;BR /&gt;
And in "data step #2", you can use a RETAIN statement to access the macro variable, assigning a SAS data variable / column value, referencing the macro variable using double-quote marks in the RETAIN statement.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 29 Jul 2008 18:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34820#M6879</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-07-29T18:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a variable to another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34821#M6880</link>
      <description>sbb, your suggestion worked !!!&lt;BR /&gt;
Thank you !!!!</description>
      <pubDate>Thu, 31 Jul 2008 21:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-a-variable-to-another-dataset/m-p/34821#M6880</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2008-07-31T21:21:51Z</dc:date>
    </item>
  </channel>
</rss>

