<?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 how to generate new variable using sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844767#M333971</link>
    <description />
    <pubDate>Thu, 17 Nov 2022 08:45:59 GMT</pubDate>
    <dc:creator>akhilbattu</dc:creator>
    <dc:date>2022-11-17T08:45:59Z</dc:date>
    <item>
      <title>how to generate new variable using sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844767#M333971</link>
      <description />
      <pubDate>Thu, 17 Nov 2022 08:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844767#M333971</guid>
      <dc:creator>akhilbattu</dc:creator>
      <dc:date>2022-11-17T08:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate new variable using sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844768#M333972</link>
      <description>&lt;P&gt;Do you simply want to generate a new variable or is there more to the question?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 08:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844768#M333972</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-11-17T08:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate new variable using sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844779#M333974</link>
      <description>&lt;P&gt;Use the following sample code:&lt;/P&gt;
&lt;PRE&gt;proc sql;
select col1 into :var1 separated by ',' from lib1.table1;
quit;&lt;/PRE&gt;
&lt;P&gt;if handle multiple columns into multiple variables, you can input the below code:&lt;/P&gt;
&lt;PRE&gt;proc sql;
select col1,col2 into :var1, :var2
from table1;
quit;&lt;/PRE&gt;
&lt;P&gt;Maybe you could look up SAS Documentation helper and find the appropriate&lt;A class="color_pc_blue_text" data-keyword="appropriate" target="_blank"&gt;&amp;nbsp;&lt;/A&gt;answers.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 09:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844779#M333974</guid>
      <dc:creator>feige</dc:creator>
      <dc:date>2022-11-17T09:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate new variable using sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844922#M334029</link>
      <description>&lt;P&gt;Generic:&lt;/P&gt;
&lt;PRE&gt;Proc Sql;
   create table wanted table as
   select &amp;lt;expression&amp;gt; as variablename
   from &amp;lt;some sort of source expression like a data set goes here&amp;gt;
  ;
quit;&lt;/PRE&gt;
&lt;P&gt;Expressions could be just about any manipulation of one or more variables.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 16:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844922#M334029</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-11-17T16:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate new variable using sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844923#M334030</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144123"&gt;@feige&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Use the following sample code:&lt;/P&gt;
&lt;PRE&gt;proc sql;
select col1 into :var1 separated by ',' from lib1.table1;
quit;&lt;/PRE&gt;
&lt;P&gt;if handle multiple columns into multiple variables, you can input the below code:&lt;/P&gt;
&lt;PRE&gt;proc sql;
select col1,col2 into :var1, :var2
from table1;
quit;&lt;/PRE&gt;
&lt;P&gt;Maybe you could look up SAS Documentation helper and find the appropriate&lt;A class="color_pc_blue_text" target="_blank" data-keyword="appropriate"&gt;&amp;nbsp;&lt;/A&gt;answers.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is not generating any variables.&amp;nbsp; The first one will populate a MACRO VARIABLE.&amp;nbsp; The second one will fail because the list of values to select goes BEFORE the INTO and the list of target macro variable names goes AFTER the INTO.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 16:57:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/844923#M334030</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-17T16:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate new variable using sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/845018#M334068</link>
      <description>&lt;P&gt;The following code generate a new variable&amp;nbsp; BMI using SAS Proc SQL&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select name, age ,height, weight ,703*weight/(height**2) as BMI format z5.2 
from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Nov 2022 01:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-generate-new-variable-using-sql/m-p/845018#M334068</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-11-18T01:03:58Z</dc:date>
    </item>
  </channel>
</rss>

