<?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: Insert Missing rows and Add Values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Insert-Missing-columns-and-Add-Values/m-p/945458#M370414</link>
    <description>&lt;P&gt;Please go back to your ORIGINAL subject line and change "columns" to "rows"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data extra;
    employee_id='A'; date='01APR2023'd; amount=53765; output;
    employee_id='B'; date='01JAN2023'd; amount=20; output;
run;

data want;
    set have extra;
run;

/* Get sums by employee_id */
proc summary data=want nway;
     class employee_id;
     var amount;
     output out=sums sum=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please, in the future, provide data &lt;FONT color="#FF0000"&gt;not&lt;/FONT&gt; as a screen capture from Excel, and &lt;FONT color="#FF0000"&gt;not&lt;/FONT&gt; via file attachments, but by creating working SAS data step code (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;examples and instructions&lt;/A&gt;) and including this code in your question. Screen captures are not acceptable, for reasons pointed out by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, and so we consider it mandatory that you provide data in working SAS data step code.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2024 13:27:37 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-09-27T13:27:37Z</dc:date>
    <item>
      <title>Insert Missing columns and Add Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Missing-columns-and-Add-Values/m-p/945454#M370412</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;I have the data as below&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="3" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Jan-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;52,332&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Feb-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;51,800&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Mar-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;53,765&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;May-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;50,879&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Jun-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;52,543&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Jul-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;82,640&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Oct-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;57,243&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;A&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Dec-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;60,763&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;B&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Feb-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;1,12,332&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;B&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Mar-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;82,843&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;B&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Jun-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;85,851&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;B&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Aug-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;84,008&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;B&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Sep-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;86,715&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;B&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Oct-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;1,17,855&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;B&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Nov-23&lt;/TD&gt;
&lt;TD width="65.325px" align="right" class="xl65" style="width: 48pt;"&gt;93,501&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="62.7375px" height="19" class="xl63" style="height: 14.4pt; width: 48pt;"&gt;B&lt;/TD&gt;
&lt;TD width="63.1375px" align="right" class="xl64" style="width: 48pt;"&gt;Dec-23&lt;/TD&gt;
&lt;TD width="65.325px" class="xl63" style="width: 48pt;"&gt;98,064&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to insert a row which should read as below&lt;/P&gt;
&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Apr-23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;53765&lt;/P&gt;
&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Jan-23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also want to get the totals based on the Employee Id. Could you help me here&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 13:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Missing-columns-and-Add-Values/m-p/945454#M370412</guid>
      <dc:creator>laxmanpai</dc:creator>
      <dc:date>2024-09-27T13:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Missing columns and Add Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Missing-columns-and-Add-Values/m-p/945457#M370413</link>
      <description>&lt;P&gt;What is the name of the dataset? What are the names of the variables?&amp;nbsp; What is the type of the variables? If the variable is character what is its defined maximum storage length?&amp;nbsp; Do the variables have any formats attached them? If so what format?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like you want to add two observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could make a new dataset and append it.&amp;nbsp; Do you know how to make a dataset?&amp;nbsp; Do you know how to use the SET statement? Or the MERGE statement? or PROC APPEND?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also use the SQL INSERT statement.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 13:05:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Missing-columns-and-Add-Values/m-p/945457#M370413</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-09-27T13:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Missing rows and Add Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-Missing-columns-and-Add-Values/m-p/945458#M370414</link>
      <description>&lt;P&gt;Please go back to your ORIGINAL subject line and change "columns" to "rows"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data extra;
    employee_id='A'; date='01APR2023'd; amount=53765; output;
    employee_id='B'; date='01JAN2023'd; amount=20; output;
run;

data want;
    set have extra;
run;

/* Get sums by employee_id */
proc summary data=want nway;
     class employee_id;
     var amount;
     output out=sums sum=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please, in the future, provide data &lt;FONT color="#FF0000"&gt;not&lt;/FONT&gt; as a screen capture from Excel, and &lt;FONT color="#FF0000"&gt;not&lt;/FONT&gt; via file attachments, but by creating working SAS data step code (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;examples and instructions&lt;/A&gt;) and including this code in your question. Screen captures are not acceptable, for reasons pointed out by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, and so we consider it mandatory that you provide data in working SAS data step code.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 13:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-Missing-columns-and-Add-Values/m-p/945458#M370414</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-09-27T13:27:37Z</dc:date>
    </item>
  </channel>
</rss>

