<?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 SAS Put Question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Put-Question/m-p/34245#M6745</link>
    <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I am merging SAS dataset A with SAS dataset C by the variable SP1.  A comes from an input file.  C comes from the result of a query.  I want to write SP1 from A and SP2 from C to the merged SAS dataset D.  However, SP2 from C is blank when it's written out.  I checked the result of the query and SP2 is not blank.  Can anyone tell me what i m doing wrong?  Here is what i have:&lt;BR /&gt;
&lt;BR /&gt;
DATA A;&lt;BR /&gt;
INFILE IN1;&lt;BR /&gt;
INPUT @01     SP1           $CHAR10.&lt;BR /&gt;
          @11     SPCD1       $CHAR03.;&lt;BR /&gt;
proc sort, by sp1;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
PROC DB2EXT OUT = C UNIQUE;&lt;BR /&gt;
  SELECT  A.ENTITYID AS SP1,&lt;BR /&gt;
                 B.ENTITYID AS SP2&lt;BR /&gt;
    FROM ADUADS01.ADVTB912 A,&lt;BR /&gt;
         ADUADS01.ADVTB912 B,&lt;BR /&gt;
 WHERE A.ENTITYID = B.ENTITYID&lt;BR /&gt;
        FOR READ ONLY;&lt;BR /&gt;
   RUN;&lt;BR /&gt;
PROC SORT; BY SP1;&lt;BR /&gt;
&lt;BR /&gt;
DATA D;&lt;BR /&gt;
MERGE A (IN=IN_A)&lt;BR /&gt;
      C (IN=IN_C);&lt;BR /&gt;
BY SP1;&lt;BR /&gt;
IF IN_A AND IN_C THEN DO;&lt;BR /&gt;
    PUT @1   SP1&lt;BR /&gt;
           @11  SP2;&lt;BR /&gt;
END;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thank you so much for your help!!!&lt;BR /&gt;
Kevin</description>
    <pubDate>Fri, 25 Jul 2008 18:30:03 GMT</pubDate>
    <dc:creator>KevinC_</dc:creator>
    <dc:date>2008-07-25T18:30:03Z</dc:date>
    <item>
      <title>SAS Put Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Put-Question/m-p/34245#M6745</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I am merging SAS dataset A with SAS dataset C by the variable SP1.  A comes from an input file.  C comes from the result of a query.  I want to write SP1 from A and SP2 from C to the merged SAS dataset D.  However, SP2 from C is blank when it's written out.  I checked the result of the query and SP2 is not blank.  Can anyone tell me what i m doing wrong?  Here is what i have:&lt;BR /&gt;
&lt;BR /&gt;
DATA A;&lt;BR /&gt;
INFILE IN1;&lt;BR /&gt;
INPUT @01     SP1           $CHAR10.&lt;BR /&gt;
          @11     SPCD1       $CHAR03.;&lt;BR /&gt;
proc sort, by sp1;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
PROC DB2EXT OUT = C UNIQUE;&lt;BR /&gt;
  SELECT  A.ENTITYID AS SP1,&lt;BR /&gt;
                 B.ENTITYID AS SP2&lt;BR /&gt;
    FROM ADUADS01.ADVTB912 A,&lt;BR /&gt;
         ADUADS01.ADVTB912 B,&lt;BR /&gt;
 WHERE A.ENTITYID = B.ENTITYID&lt;BR /&gt;
        FOR READ ONLY;&lt;BR /&gt;
   RUN;&lt;BR /&gt;
PROC SORT; BY SP1;&lt;BR /&gt;
&lt;BR /&gt;
DATA D;&lt;BR /&gt;
MERGE A (IN=IN_A)&lt;BR /&gt;
      C (IN=IN_C);&lt;BR /&gt;
BY SP1;&lt;BR /&gt;
IF IN_A AND IN_C THEN DO;&lt;BR /&gt;
    PUT @1   SP1&lt;BR /&gt;
           @11  SP2;&lt;BR /&gt;
END;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thank you so much for your help!!!&lt;BR /&gt;
Kevin</description>
      <pubDate>Fri, 25 Jul 2008 18:30:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Put-Question/m-p/34245#M6745</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2008-07-25T18:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Put Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Put-Question/m-p/34246#M6746</link>
      <description>I guess the question could have been "how do i write a variable to a temporary SAS dataset?"&lt;BR /&gt;
&lt;BR /&gt;
I could write it to an output file.  But That's not really what I need.  I m just running a series of merges.  That's why I am using temporary sas datasets.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance for any input !!</description>
      <pubDate>Fri, 25 Jul 2008 18:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Put-Question/m-p/34246#M6746</guid>
      <dc:creator>KevinC_</dc:creator>
      <dc:date>2008-07-25T18:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Put Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Put-Question/m-p/34247#M6747</link>
      <description>Need to see some SASLOG session output with PUTLOG _ALL_; commands in order to understand your data conditions -- you also may find this debugging technique revealing as well.  Also, you should confirm that SP1 is consistent in both input files, specifically, if a "formatted value" is being displayed for diagnosis, you may find that the "SAS internal value" shows that the two sources are not equal.  Lastly, using the PUTLOG _ALL_;  command will show the IN= variable values from your MERGE operation -- info that could be very revealing for your own diagnosis.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 29 Jul 2008 18:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Put-Question/m-p/34247#M6747</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-07-29T18:18:31Z</dc:date>
    </item>
  </channel>
</rss>

