<?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: Add new variable in dataset and have word for all records in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564494#M158354</link>
    <description>&lt;P&gt;Is this what you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set sashelp.class;
   retain Checked 'Y';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 07 Jun 2019 15:34:16 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-06-07T15:34:16Z</dc:date>
    <item>
      <title>Add new variable in dataset and have word for all records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564492#M158352</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way of creating a new variable e.g &lt;FONT color="#FF0000"&gt;Checked&lt;/FONT&gt; and having &lt;U&gt;&lt;FONT color="#FF0000"&gt;all&lt;/FONT&gt;&lt;/U&gt; of the records have &lt;FONT color="#FF0000"&gt;Y&lt;/FONT&gt; as the result in the &lt;FONT color="#FF0000"&gt;checked variable&lt;/FONT&gt;, because I want this 'Y' flag to be apparent (for all records in this&amp;nbsp;ac.list_Jan_Nov dataset) when I left join this dataset onto another dataset? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;set ac.list_Jan_Nov;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;[What code to include here so that all records in&amp;nbsp;ac.list_Jan_Nov dataset are selected?] .... &lt;FONT color="#000000"&gt;then Checked='Y';&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 15:23:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564492#M158352</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-06-07T15:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add new variable in dataset and have word for all records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564494#M158354</link>
      <description>&lt;P&gt;Is this what you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set sashelp.class;
   retain Checked 'Y';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Jun 2019 15:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564494#M158354</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-07T15:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Add new variable in dataset and have word for all records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564496#M158356</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply. 'Checked' is currently not a variable in my ac.list_Jan_Nov dataset, but I would like to create the new 'Checked' variable (that is why I wrote &lt;FONT color="#FF0000"&gt;then Checked = 'Y';&lt;/FONT&gt; in the code above) and have all of the records in the ac.list_Jan_Nov dataset have Y for the 'Checked' variable, as all of the records have been checked and when I left join this dataset, I will know that the records in this dataset have been checked. Would the RETAIN statement help to do this?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 15:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564496#M158356</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-06-07T15:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Add new variable in dataset and have word for all records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564497#M158357</link>
      <description>&lt;P&gt;Have you tried my code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variable checked is not in the SASHELP.CLASS data set either. The retain statement ensures that it has the value 'Y' for each record&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 15:40:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564497#M158357</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-07T15:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Add new variable in dataset and have word for all records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564499#M158359</link>
      <description>Did you try the code? Pretty sure that's what it does. &lt;BR /&gt;&lt;BR /&gt;If you want it in SQL, its like this;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table want as &lt;BR /&gt;select *, 'Y' as checked&lt;BR /&gt; from sashelp.class;&lt;BR /&gt;quit;</description>
      <pubDate>Fri, 07 Jun 2019 15:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564499#M158359</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-07T15:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Add new variable in dataset and have word for all records</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564500#M158360</link>
      <description>Perfect, thanks a lot for your help!</description>
      <pubDate>Fri, 07 Jun 2019 15:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-new-variable-in-dataset-and-have-word-for-all-records/m-p/564500#M158360</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-06-07T15:44:11Z</dc:date>
    </item>
  </channel>
</rss>

