<?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: Repeat same value on every row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Repeat-same-value-on-every-row/m-p/632586#M187567</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5629"&gt;@Q1983&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you need to create tot2 to calculate percentages?&lt;/P&gt;
&lt;P&gt;You can simply do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  format pct percent10.2;
  pct=tot/100;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
    <pubDate>Tue, 17 Mar 2020 08:03:41 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-03-17T08:03:41Z</dc:date>
    <item>
      <title>Repeat same value on every row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-same-value-on-every-row/m-p/632562#M187553</link>
      <description>&lt;P&gt;data have;&lt;BR /&gt;length ln Status $25. ;&lt;BR /&gt;input ln Status Month date9. Curr Due_030 tot;&lt;BR /&gt;return;&lt;BR /&gt;datalines;&lt;BR /&gt;122 Current 01Nov2019 1 0 100&lt;BR /&gt;122 Current 30Nov2019 1 0 1&lt;BR /&gt;122 Due_030 01Dec2019 0 0 5&lt;BR /&gt;122 Due_030 31Dec2019 0 1 2&lt;BR /&gt;;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The last column is called tot.&amp;nbsp; Is there a way to repeat the top number (in this case 100) on all rows with a column name tot2&lt;/P&gt;
&lt;P&gt;I want to get the percentage of tot by tot2 (ie 100/100, 1/100, 5/100)&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 03:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-same-value-on-every-row/m-p/632562#M187553</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2020-03-17T03:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat same value on every row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-same-value-on-every-row/m-p/632565#M187554</link>
      <description>&lt;P&gt;Below doing what you've been asking for.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  length ln Status $25.;
  input ln Status Month date9. Curr Due_030 tot;
  return;
  datalines;
122 Current 01Nov2019 1 0 100
122 Current 30Nov2019 1 0 1
122 Due_030 01Dec2019 0 0 5
122 Due_030 31Dec2019 0 1 2
;

data want;
  set have;
  retain tot2;
  format pct percent10.2;
  if _n_=1 then
    tot2=tot;
  pct=tot/tot2;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Mar 2020 03:38:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-same-value-on-every-row/m-p/632565#M187554</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-17T03:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat same value on every row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-same-value-on-every-row/m-p/632586#M187567</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5629"&gt;@Q1983&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you need to create tot2 to calculate percentages?&lt;/P&gt;
&lt;P&gt;You can simply do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  format pct percent10.2;
  pct=tot/100;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 08:03:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-same-value-on-every-row/m-p/632586#M187567</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-03-17T08:03:41Z</dc:date>
    </item>
  </channel>
</rss>

