<?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: How to create a variable with values as 1 in proc sql in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465682#M30153</link>
    <description>&lt;P&gt;Please post a clear example of what you have - test data in the form of a datastep - and what you want out at the end.&amp;nbsp; Otherwise you will not get good answers.&amp;nbsp; Simply:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as
  select *,
         1 as new_var
  from   have;
quit;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 May 2018 12:56:34 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-05-29T12:56:34Z</dc:date>
    <item>
      <title>How to create a variable with values as 1 in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465671#M30151</link>
      <description>&lt;P&gt;How to create a variable with values as 1 in proc sql&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 12:32:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465671#M30151</guid>
      <dc:creator>saikiran_nemani</dc:creator>
      <dc:date>2018-05-29T12:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable with values as 1 in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465676#M30152</link>
      <description>&lt;P&gt;I'm guessing that you want to create dummy variables to prep data for modeling.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do this with simple boolean expressions.&amp;nbsp; Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
 create table dummy_class
  as select name, age,
   sex="M" as isMale,
   sex="F" as isFemale
 from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dummy.png" style="width: 401px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20827iC46915C4FB05B6E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="dummy.png" alt="dummy.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 12:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465676#M30152</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-05-29T12:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable with values as 1 in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465682#M30153</link>
      <description>&lt;P&gt;Please post a clear example of what you have - test data in the form of a datastep - and what you want out at the end.&amp;nbsp; Otherwise you will not get good answers.&amp;nbsp; Simply:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as
  select *,
         1 as new_var
  from   have;
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 May 2018 12:56:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465682#M30153</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-29T12:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable with values as 1 in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465688#M30155</link>
      <description>&lt;P&gt;If your trying to create a new variable on a condition on other variable then you can use a case expression.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select *, Case  when Age&amp;gt;15 then 1 
				when Age&amp;lt;13 then 0
			else 2 end as new_var
	from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 May 2018 13:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465688#M30155</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-05-29T13:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable with values as 1 in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465724#M30165</link>
      <description>&lt;P&gt;Homework question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/How-to-create-a-table-of-0s-and-1s-using-proc-sql/m-p/465556" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/How-to-create-a-table-of-0s-and-1s-using-proc-sql/m-p/465556&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 14:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465724#M30165</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-29T14:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable with values as 1 in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465740#M30169</link>
      <description>&lt;P&gt;If you just want a variable that's always 1:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
	create table want as select name,
		1 as OneVar
	from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 15:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-variable-with-values-as-1-in-proc-sql/m-p/465740#M30169</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-05-29T15:56:48Z</dc:date>
    </item>
  </channel>
</rss>

