<?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: Enter zero filled row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606860#M176301</link>
    <description>&lt;P&gt;Figured it out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Ccy_Ref;
  input Ccy_Order:8. Ccy:$10.;
datalines;
3 JPY
4 OTHERS
2 PHP
1 USD
;
run;

DATA want;
 MERGE have ccy_ref;
 BY Ccy Ccy_Order;
 RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 25 Nov 2019 01:17:17 GMT</pubDate>
    <dc:creator>sustagens</dc:creator>
    <dc:date>2019-11-25T01:17:17Z</dc:date>
    <item>
      <title>Enter zero filled row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606398#M176087</link>
      <description>&lt;P&gt;Hi, just struggling how to best cope with summarising data with null variants?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of my summarised datasets look like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="variants.png" style="width: 286px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34155iC4E9CB035D03F897/image-size/large?v=v2&amp;amp;px=999" role="button" title="variants.png" alt="variants.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to be able to insert a dummy row, with a value of 3 for &lt;U&gt;Ccy_Order&lt;/U&gt; and value of JPY for &lt;U&gt;Ccy&lt;/U&gt;, and all the rest of the "EXPYYYYMM" columns to the right should be null.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sometimes the row for Ccy_Order 2 will be missing, sometimes for 1 or 4 - I just need all four types to be present.&lt;/P&gt;
&lt;P&gt;Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 07:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606398#M176087</guid>
      <dc:creator>sustagens</dc:creator>
      <dc:date>2019-11-22T07:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Enter zero filled row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606399#M176088</link>
      <description>&lt;P&gt;How did you summarize your data?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 07:27:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606399#M176088</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-22T07:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Enter zero filled row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606400#M176089</link>
      <description>&lt;P&gt;I have a suspicion that you start initialky with a long dataset format and transpose later. Please post that data in usable form (data step with datalines).&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 07:33:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606400#M176089</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-22T07:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Enter zero filled row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606403#M176091</link>
      <description>&lt;P&gt;The initial data is filtered, for just MNCs.&lt;/P&gt;
&lt;P&gt;My data has transactions, and sometimes not all the currencies (USD/PHP/JPY/OTHERS) are transacted on, but the report format should be retained for all four whether there were any for the period or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
   CREATE TABLE want AS 
   SELECT DISTINCT Ccy, 
		  Base_YM,
		  (SUM(EXPOSURE)) FORMAT=COMMA23.2 AS EXPOSURE, 
		  Ccy_Order
      FROM have 
      WHERE Trans="MNC"
      GROUP BY Ccy_Order, Ccy, Base_YM
      ORDER BY Ccy_Order, Base_YM;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is sample data for my have table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input Ccy:$6. Base_YM:$6. EXPOSURE:COMMA23.2 Ccy_Order:32.;
  format EXPOSURE COMMA23.2 ;
datalines;
USD 201504 30000000 1
USD 201505 30000000 1
USD 201506 30000000 1
USD 201507 30000000 1
USD 201508 30000000 1
USD 201509 30000000 1
USD 201510 30000000 1
USD 201511 30000000 1
PHP 201510 65000000000 2
PHP 201511 50000000000 2
PHP 201512 50000000000 2
PHP 201601 55000000000 2
PHP 201602 60000000000 2
PHP 201910 250600000000 2
OTHERS 201910 8500000000 4
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I then transposed that so that I have the dates as the columns.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC TRANSPOSE DATA=want 
	OUT=TRNS_want (drop=_NAME_)
	PREFIX=EXP
	LABEL=Label
;
	BY Ccy_Order Ccy;
	ID Base_YM;
	VAR EXPOSURE;
RUN; QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Nov 2019 07:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606403#M176091</guid>
      <dc:creator>sustagens</dc:creator>
      <dc:date>2019-11-22T07:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Enter zero filled row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606860#M176301</link>
      <description>&lt;P&gt;Figured it out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Ccy_Ref;
  input Ccy_Order:8. Ccy:$10.;
datalines;
3 JPY
4 OTHERS
2 PHP
1 USD
;
run;

DATA want;
 MERGE have ccy_ref;
 BY Ccy Ccy_Order;
 RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Nov 2019 01:17:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enter-zero-filled-row/m-p/606860#M176301</guid>
      <dc:creator>sustagens</dc:creator>
      <dc:date>2019-11-25T01:17:17Z</dc:date>
    </item>
  </channel>
</rss>

