<?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: enter value from one dataset into another in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/enter-value-from-one-dataset-into-another/m-p/204452#M50951</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use a macro variable and sql to automate this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select openingbal into :init_value from opening;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;* make sure that opening has only one observation, or use a where condition to only get the observation you want;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data daily1;&lt;/P&gt;&lt;P&gt;set daily;&lt;/P&gt;&lt;P&gt;retain accruingbal &amp;amp;init_value;&lt;/P&gt;&lt;P&gt;accruingbal+amount;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: adapted my original posting to your variable/dataset names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Jun 2015 05:48:02 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2015-06-12T05:48:02Z</dc:date>
    <item>
      <title>enter value from one dataset into another</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/enter-value-from-one-dataset-into-another/m-p/204449#M50948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like help to code this please ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;currently I have a data step that is coded:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;data daily1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;set daily;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;retain accruingbal 3451.76;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;accruingbal+amount;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.. but it means I manually have to enter the amount each time I run it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can I write it to get the amount from another dataset?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;data daily1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;set daily;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;retain accruingbal &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;= value called Openingbal in dataset called Opening&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;accruingbal+amount;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 23:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/enter-value-from-one-dataset-into-another/m-p/204449#M50948</guid>
      <dc:creator>franph</dc:creator>
      <dc:date>2015-06-11T23:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: enter value from one dataset into another</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/enter-value-from-one-dataset-into-another/m-p/204450#M50949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data daily1;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;merge daily x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;by byvariable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;retain &lt;SPAN style="font-family: courier new,courier;"&gt;accruingbal&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;accruingbal+amount;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;Please try this untested code.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 23:29:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/enter-value-from-one-dataset-into-another/m-p/204450#M50949</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-06-11T23:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: enter value from one dataset into another</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/enter-value-from-one-dataset-into-another/m-p/204451#M50950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Presumably you are confident that there is only one observation in the "Opening" dataset?&amp;nbsp; You can read it the first time through the data step but not thereafter: &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;data daily1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;drop openingbal;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;if _N_ = 1 then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;&amp;nbsp; set opening(keep = openingbal);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;&amp;nbsp; accruingbal = openingbal;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;end;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;set daily;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;accruingbal+amount;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 03:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/enter-value-from-one-dataset-into-another/m-p/204451#M50950</guid>
      <dc:creator>dkb</dc:creator>
      <dc:date>2015-06-12T03:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: enter value from one dataset into another</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/enter-value-from-one-dataset-into-another/m-p/204452#M50951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use a macro variable and sql to automate this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;select openingbal into :init_value from opening;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;* make sure that opening has only one observation, or use a where condition to only get the observation you want;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data daily1;&lt;/P&gt;&lt;P&gt;set daily;&lt;/P&gt;&lt;P&gt;retain accruingbal &amp;amp;init_value;&lt;/P&gt;&lt;P&gt;accruingbal+amount;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: adapted my original posting to your variable/dataset names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jun 2015 05:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/enter-value-from-one-dataset-into-another/m-p/204452#M50951</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-06-12T05:48:02Z</dc:date>
    </item>
  </channel>
</rss>

