<?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: Write newly created variable to another dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Write-newly-created-variable-to-another-dataset/m-p/779334#M248187</link>
    <description>&lt;P&gt;It is not clear what you want to do but it looks like you want to generate data from HAVE and append it to APPENDED_TABLE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  var4=var2*2;
  keep var2 var4;
run;

proc append data=want base=appended_table;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 14:16:28 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-11-09T14:16:28Z</dc:date>
    <item>
      <title>Write newly created variable to another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-newly-created-variable-to-another-dataset/m-p/779333#M248186</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have one dataset as below named &lt;STRONG&gt;Have&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Var1 Var2 Var3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;10 20 30&lt;/P&gt;&lt;P&gt;40 50 60&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to append 2 variables to dataset&amp;nbsp;which is already present and has structure and data as below&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Appended_table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Var2 Var4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;100 200&lt;/P&gt;&lt;P&gt;300 400&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data want ;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;var4=var1*2;&lt;/P&gt;&lt;P&gt;/*&lt;STRONG&gt;Above step is the operation to be done */&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/* I want Var1 and var4 to be appended in Appended table mentioned below*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the output that I want in Appended_table dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Appended_table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Var2 Var4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;100 200&lt;/P&gt;&lt;P&gt;300 400&lt;/P&gt;&lt;P&gt;20 40&lt;/P&gt;&lt;P&gt;50 100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried both proc append and creating the macro variable but somehow could not get it right. Any help is really appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-newly-created-variable-to-another-dataset/m-p/779333#M248186</guid>
      <dc:creator>Swapnil_21</dc:creator>
      <dc:date>2021-11-09T14:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Write newly created variable to another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-newly-created-variable-to-another-dataset/m-p/779334#M248187</link>
      <description>&lt;P&gt;It is not clear what you want to do but it looks like you want to generate data from HAVE and append it to APPENDED_TABLE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  var4=var2*2;
  keep var2 var4;
run;

proc append data=want base=appended_table;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-newly-created-variable-to-another-dataset/m-p/779334#M248187</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-09T14:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Write newly created variable to another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-newly-created-variable-to-another-dataset/m-p/779336#M248188</link>
      <description>&lt;P&gt;I am extremely confused.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you mean by "append"? It seems as if you are using "append" to describe what you are doing with variables and also the same word "append" is describing what you are doing to two data sets.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-newly-created-variable-to-another-dataset/m-p/779336#M248188</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-09T14:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Write newly created variable to another dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-newly-created-variable-to-another-dataset/m-p/779339#M248189</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input var1-var3;
cards;
10 20 30
40 50 60
;
run;

data Appended_table;
input var2 var4;
cards;
100 200
300 400
;
run;

data Appended_table2;
   set Appended_table have(in=a) ;
   if a then var4=var1*2;*Did U mean var4=var2*2 ?;
   keep var2 var4;
run;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Nov 2021 14:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-newly-created-variable-to-another-dataset/m-p/779339#M248189</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-11-09T14:22:31Z</dc:date>
    </item>
  </channel>
</rss>

