<?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: Need a Macro to update the values in the datastep automatically from an excel sheet in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151705#M29894</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops! I deleted this after I figured it out a few mins later, so I'm not sure this will even show up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought I had tried to remove trailing blanks with %TRIM and it didn't work, but I noticed that I had a typo when I did that. Using %Trim on &amp;amp;userLib and then trying the new variable in the libname statement worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Mar 2014 12:46:15 GMT</pubDate>
    <dc:creator>cau83</dc:creator>
    <dc:date>2014-03-21T12:46:15Z</dc:date>
    <item>
      <title>Need a Macro to update the values in the datastep automatically from an excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151701#M29890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi i have an excel sheet with two variables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;name expenditure&lt;/P&gt;&lt;P&gt;a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15782&lt;/P&gt;&lt;P&gt;b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 516858&lt;/P&gt;&lt;P&gt;c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1686&lt;/P&gt;&lt;P&gt;d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 152818&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the values for the expenditure will keep on changing every month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at present i am changing the values in my data step manually to check the conditions.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;i am looking for a macro such that it will update the values in the data step automatically from the external excel sheet.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;thanks in advance &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2014 07:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151701#M29890</guid>
      <dc:creator>Nagendra</dc:creator>
      <dc:date>2014-03-21T07:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Macro to update the values in the datastep automatically from an excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151702#M29891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the excel sheet is in a standard format you can use a proc import step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; proc import&amp;nbsp; datafile="path\spreadsheet.xlsx" out=want dbms=csv replace;&lt;/P&gt;&lt;P&gt;getnames=yes;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2014 09:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151702#M29891</guid>
      <dc:creator>Murray_Court</dc:creator>
      <dc:date>2014-03-21T09:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Macro to update the values in the datastep automatically from an excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151703#M29892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Depends what you are doing, if the data in your dataset matches what you want in the dataset then just import the xls and overwrite your old dataset, per Murray_Court's response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a dataset and you only want to change some of the data then its slightly more complicated.&amp;nbsp; First import the data as above.&amp;nbsp; Then run an sql update statement, e.g.&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; update table have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expenditure=imported_expenditure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import_file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where name=imported_name;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2014 09:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151703#M29892</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-03-21T09:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Macro to update the values in the datastep automatically from an excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151704#M29893</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;You could possibly try UPDATE statement to reflect the changing expenditure in your dataset .&lt;/P&gt;&lt;P&gt;for eg , consider master dataset as &lt;/P&gt;&lt;P&gt;data repl;&lt;/P&gt;&lt;P&gt;input NAME $ EXPENDITURE;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;a 15782&lt;/P&gt;&lt;P&gt;b 516858&lt;/P&gt;&lt;P&gt;c 1686&lt;/P&gt;&lt;P&gt;d 152818&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the transaction dataset as&lt;/P&gt;&lt;P&gt;data rep2;&lt;/P&gt;&lt;P&gt;input NAME $ EXPENDITURE;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;a 1000&lt;/P&gt;&lt;P&gt;b 516858&lt;/P&gt;&lt;P&gt;c 2000&lt;/P&gt;&lt;P&gt;d 152818&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then using the update command&lt;/P&gt;&lt;P&gt;data rep1;&lt;/P&gt;&lt;P&gt;update repl rep2;&lt;/P&gt;&lt;P&gt;by name;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above syntax would require you to have 2 sets of data Main and transaction datasets .&lt;/P&gt;&lt;P&gt;Hopefully, this is solves your query .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2014 11:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151704#M29893</guid>
      <dc:creator>Pinky9</dc:creator>
      <dc:date>2014-03-21T11:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Macro to update the values in the datastep automatically from an excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151705#M29894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops! I deleted this after I figured it out a few mins later, so I'm not sure this will even show up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought I had tried to remove trailing blanks with %TRIM and it didn't work, but I noticed that I had a typo when I did that. Using %Trim on &amp;amp;userLib and then trying the new variable in the libname statement worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Mar 2014 12:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-a-Macro-to-update-the-values-in-the-datastep-automatically/m-p/151705#M29894</guid>
      <dc:creator>cau83</dc:creator>
      <dc:date>2014-03-21T12:46:15Z</dc:date>
    </item>
  </channel>
</rss>

