<?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: first.variable and call missing help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515700#M139186</link>
    <description>&lt;P&gt;This statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if last.cihi_key then output;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Means only one row for each value of cihi_key will be output and it will be the last row if there are multiple rows with the same value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 24 Nov 2018 04:44:46 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2018-11-24T04:44:46Z</dc:date>
    <item>
      <title>first.variable and call missing help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515694#M139182</link>
      <description>&lt;P&gt;data O1617_wide;&lt;BR /&gt;set O1617_sorted;&lt;BR /&gt;by cihi_key;&lt;BR /&gt;retain var_cost fix_cost new_idc totalcost;&lt;BR /&gt;if first.cihi_key then call missing(var_cost, fix_Cost, new_idc, totalcost);&lt;BR /&gt;var_cost = sum(VDC_LABOUR,VDC_SUPPLY_GENE,VDC_SUPPLY_SPEC,VDC_OTHER);&lt;BR /&gt;fix_Cost=sum(FDC_LABOUR,FDC_OTHER,FDC_EQU);&lt;BR /&gt;new_idc = sum(IVC, IFC);&lt;BR /&gt;totalcost=sum(DC,IDC);&lt;BR /&gt;if last.cihi_key then output;&lt;BR /&gt;drop VDC_LABOUR VDC_SUPPLY_GENE VDC_SUPPLY_SPEC VDC_OTHER FDC_LABOUR FDC_OTHER FDC_EQU IVC IFC;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone advise what would call missing do in the above code and which records will be output?&lt;/P&gt;</description>
      <pubDate>Sat, 24 Nov 2018 02:22:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515694#M139182</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-24T02:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: first.variable and call missing help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515697#M139184</link>
      <description>&lt;P&gt;Hi Ranjeeta,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Call Missing routine assign an ordinary numeric value . (dot) to each numeric variable in the argument list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your case whenever if condition is true for first group variable, call routine assign . (dot) value for all listed variable. later when the next group variable will come it will again assign the same .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if first.cihi_key then call missing(var_cost, fix_Cost, new_idc, totalcost);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks...&lt;/P&gt;</description>
      <pubDate>Sat, 24 Nov 2018 04:20:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515697#M139184</guid>
      <dc:creator>singhsahab</dc:creator>
      <dc:date>2018-11-24T04:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: first.variable and call missing help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515700#M139186</link>
      <description>&lt;P&gt;This statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if last.cihi_key then output;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Means only one row for each value of cihi_key will be output and it will be the last row if there are multiple rows with the same value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Nov 2018 04:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515700#M139186</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-11-24T04:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: first.variable and call missing help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515745#M139219</link>
      <description>&lt;P&gt;This program was likely written by someone who didn't know what they were doing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALL MISSING could be removed.&amp;nbsp; The variables that it impacts are all replaced by the next four lines in the program.&amp;nbsp; Those variables would have the same values even if CALL MISSING was not part of the program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The program outputs only one observation per CIHI_KEY ... the very last one.&amp;nbsp; However, it does NOT add up anything across observations.&amp;nbsp; If a CIHI_KEY has 10 observations, the first nine are totally ignored and have no impact on the final result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In order to clean up the programming logic, you need to thoroughly understand what the program is supposed to accomplish.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Nov 2018 21:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515745#M139219</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-24T21:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: first.variable and call missing help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515774#M139232</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;, pay attention that call missing relates to retained variables&lt;/P&gt;
&lt;P&gt;in order to sum input variables which are droped at output&lt;/P&gt;
&lt;PRE&gt;retain var_cost fix_cost new_idc totalcost;
if first.cihi_key then call missing(var_cost, fix_Cost, new_idc, totalcost);&lt;/PRE&gt;
&lt;P&gt;sum() function ignores missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it seems to me that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/153275"&gt;@singhsahab&lt;/a&gt;&amp;nbsp;answer is the right and relevant one.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Nov 2018 07:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515774#M139232</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-25T07:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: first.variable and call missing help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515881#M139269</link>
      <description>&lt;P&gt;So far, there is no real answer.&amp;nbsp; CALL MISSING works on retained variables, but that doesn't really matter.&amp;nbsp; Those variables get replaced right after CALL MISSING executes ... every time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no attempt to sum up anything across observations ... at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no reason to compute the retained variables, if they are going to be replaced, and the observation then deleted most of the time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are missing any sort of explanation as to what the program is trying to accomplish.&amp;nbsp; So yes, there is an answer as to what CALL MISSING does.&amp;nbsp; But there are bigger questions about how to fix a nonworking program.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 02:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/515881#M139269</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-26T02:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: first.variable and call missing help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/517147#M139743</link>
      <description>In the above program the variable var_cost is missing from the sum functon</description>
      <pubDate>Thu, 29 Nov 2018 17:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/517147#M139743</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-11-29T17:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: first.variable and call missing help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/517231#M139793</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;was right. To fix the code try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data O1617_wide;
  set O1617_sorted;
by cihi_key;
    retain var_cost fix_cost new_idc totalcost;

   if first.cihi_key then call missing(var_cost, fix_Cost, new_idc, totalcost);

var_cost = sum(var_cost, VDC_LABOUR, VDC_SUPPLY_GENE, VDC_SUPPLY_SPEC, VDC_OTHER);

fix_Cost=sum(fix_Cost, FDC_LABOUR, FDC_OTHER, FDC_EQU);

new_idc = sum(new_idc, IVC, IFC);

totalcost=sum(totalcost, DC, IDC);

if last.cihi_key then output;

drop VDC_LABOUR VDC_SUPPLY_GENE VDC_SUPPLY_SPEC VDC_OTHER FDC_LABOUR FDC_OTHER FDC_EQU IVC IFC;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 20:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-variable-and-call-missing-help/m-p/517231#M139793</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-29T20:42:58Z</dc:date>
    </item>
  </channel>
</rss>

