<?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 to output a column of numeric values that are stored in macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-output-a-column-of-numeric-values-that-are-stored-in/m-p/110794#M22993</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is my main program, which calls a SAS macro: &lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to do: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to populate the column "CT" in the Excel file with numeric numbers, which are essentially the value of the variable created in this SAS program. Please refer to the Excel file attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In worksheet "Test 2", you will see column CT, which already has values generated, but this is just test data. I would actually need to run this SAS program to be able to generate those numbers in column CT so that I can test and see if they match with what I already have in the Excel file. (The program needs to apply to every line of record in Excel, as you can tell). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can the SAS program do that for me? If it doesn't output to Excel, that's fine,but the bottom line is I need to have column CT populated with numbers as a result of running above SAS code in SAS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this possible? Is anyone able to assist me on this please? I'm new to SAS macro&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 May 2012 18:31:06 GMT</pubDate>
    <dc:creator>SeekYourWay</dc:creator>
    <dc:date>2012-05-10T18:31:06Z</dc:date>
    <item>
      <title>SAS to output a column of numeric values that are stored in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-output-a-column-of-numeric-values-that-are-stored-in/m-p/110794#M22993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is my main program, which calls a SAS macro: &lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to do: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to populate the column "CT" in the Excel file with numeric numbers, which are essentially the value of the variable created in this SAS program. Please refer to the Excel file attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In worksheet "Test 2", you will see column CT, which already has values generated, but this is just test data. I would actually need to run this SAS program to be able to generate those numbers in column CT so that I can test and see if they match with what I already have in the Excel file. (The program needs to apply to every line of record in Excel, as you can tell). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can the SAS program do that for me? If it doesn't output to Excel, that's fine,but the bottom line is I need to have column CT populated with numbers as a result of running above SAS code in SAS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this possible? Is anyone able to assist me on this please? I'm new to SAS macro&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 18:31:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-to-output-a-column-of-numeric-values-that-are-stored-in/m-p/110794#M22993</guid>
      <dc:creator>SeekYourWay</dc:creator>
      <dc:date>2012-05-10T18:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to output a column of numeric values that are stored in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-output-a-column-of-numeric-values-that-are-stored-in/m-p/110795#M22994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I think you may be almost there.&amp;nbsp; It looks like all you have to do is output your work dataset to an excel file.&amp;nbsp; (Without some actual test data, I can't test for sure.)&lt;/P&gt;&lt;P&gt;I have added a few comments to your main code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Main Program;&amp;nbsp; &lt;/P&gt;&lt;P&gt;DATA test;&lt;/P&gt;&lt;P&gt;SET sasuser.test;&lt;/P&gt;&lt;P&gt;%A01_CPS_MH;&lt;/P&gt;&lt;P&gt;run ;&amp;nbsp; * I&amp;nbsp; recommend putting a run statement at the end of every data step, for clarity as well as to ensure execution if no other steps follow this one;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc export data = test outfile ="C:\mySASfolder\myTestScoreResults.xlsx" DBMS=Excel2007 replace ;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MEND scipp_2012_program; * this statement is outside of your data step ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2013 15:11:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-to-output-a-column-of-numeric-values-that-are-stored-in/m-p/110795#M22994</guid>
      <dc:creator>cwilson</dc:creator>
      <dc:date>2013-01-03T15:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS to output a column of numeric values that are stored in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-to-output-a-column-of-numeric-values-that-are-stored-in/m-p/110796#M22995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with cwilson that your program appears to do what you want.&amp;nbsp; You don't really need to wrap the code in SAS macros, as you could have just included the code in a data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You also appear to have written &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;scipp_2012_program&lt;/SPAN&gt; as a SAS macro.&amp;nbsp; Again, not necessary, but it will still work that way.&amp;nbsp; However, if you are going to keep it as a macro, you have to change the first line and then call the macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus, stealing Carla's suggested code, you could use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;scipp_2012_program&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; DATA test;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET sasuser.test;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %A01_CPS_MH&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; proc export data = test outfile ="C:\mySASfolder\myTestScoreResults.xlsx" DBMS=Excel2007 replace ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%MEND scipp_2012_program;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&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-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%scipp_2012_program&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-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2013 17:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-to-output-a-column-of-numeric-values-that-are-stored-in/m-p/110796#M22995</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-01-03T17:52:10Z</dc:date>
    </item>
  </channel>
</rss>

