<?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 %Let Equal a value from a Table in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Let-Equal-a-value-from-a-Table/m-p/25802#M5877</link>
    <description>Hello&lt;BR /&gt;
&lt;BR /&gt;
I am new to the forum and I am not sure if I am posting in the correct place.&lt;BR /&gt;
&lt;BR /&gt;
I would like to assign a value to a name and then use that in other procedures, say&lt;BR /&gt;
&lt;BR /&gt;
%Let = select Profit from MyTable where Month = 'Feb'&lt;BR /&gt;
&lt;BR /&gt;
So then when I am working in another table I can use this in a datastep for example.&lt;BR /&gt;
&lt;BR /&gt;
I am not sure if it is a stupid question?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
    <pubDate>Fri, 04 Dec 2009 11:41:13 GMT</pubDate>
    <dc:creator>AldousA</dc:creator>
    <dc:date>2009-12-04T11:41:13Z</dc:date>
    <item>
      <title>%Let Equal a value from a Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Let-Equal-a-value-from-a-Table/m-p/25802#M5877</link>
      <description>Hello&lt;BR /&gt;
&lt;BR /&gt;
I am new to the forum and I am not sure if I am posting in the correct place.&lt;BR /&gt;
&lt;BR /&gt;
I would like to assign a value to a name and then use that in other procedures, say&lt;BR /&gt;
&lt;BR /&gt;
%Let = select Profit from MyTable where Month = 'Feb'&lt;BR /&gt;
&lt;BR /&gt;
So then when I am working in another table I can use this in a datastep for example.&lt;BR /&gt;
&lt;BR /&gt;
I am not sure if it is a stupid question?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Fri, 04 Dec 2009 11:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Let-Equal-a-value-from-a-Table/m-p/25802#M5877</guid>
      <dc:creator>AldousA</dc:creator>
      <dc:date>2009-12-04T11:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: %Let Equal a value from a Table</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Let-Equal-a-value-from-a-Table/m-p/25803#M5878</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I think you should have posted your topic in the following discussion forum:&lt;BR /&gt;
&lt;B&gt;SAS Macro Facility, Data Step and SAS Language Elements&lt;/B&gt; &lt;BR /&gt;
&lt;BR /&gt;
To create a macro-variable from the result of a SQL query, you have to use the following proc sql:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
        select Profit&lt;BR /&gt;
        into :Profit        /* You can give the name you want but have to make sure */&lt;BR /&gt;
        from MyTable   /*  that your SQL query will only return 1 value. */&lt;BR /&gt;
        where Month = 'Feb';&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Have a look to the following link in order to get more details about the possibilities you have to generate macro-variables with PROC SQL:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001360983.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a001360983.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Florent</description>
      <pubDate>Fri, 04 Dec 2009 11:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Let-Equal-a-value-from-a-Table/m-p/25803#M5878</guid>
      <dc:creator>Florent</dc:creator>
      <dc:date>2009-12-04T11:57:59Z</dc:date>
    </item>
  </channel>
</rss>

