<?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: Merge Two Values Across Two Observations Into One Value in One Observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-Two-Values-Across-Two-Observations-Into-One-Value-in-One/m-p/448050#M283381</link>
    <description>&lt;P&gt;Have you looked at this paper?&lt;/P&gt;
&lt;P&gt;"Preserving Line Breaks When Exporting to Excel"&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.pharmasug.org/proceedings/2014/CC/PharmaSUG-2014-CC07.pdf" target="_blank"&gt;https://www.pharmasug.org/proceedings/2014/CC/PharmaSUG-2014-CC07.pdf&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Mar 2018 04:16:31 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-03-23T04:16:31Z</dc:date>
    <item>
      <title>Merge Two Values Across Two Observations Into One Value in One Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-Two-Values-Across-Two-Observations-Into-One-Value-in-One/m-p/447859#M283380</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The director of my unit has asked me to augment certain metrics with a 1-year and 5-year change (in the form of a percentage). The audience needs to quickly see the change in time. So there is one row per metric in the Excel spreadsheet that I have to create, but the director would like the two percentages placed in one cell in this form:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Metric&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Current Value&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Change&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Graduation Rate&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;81%&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1yrΔ+0.4%&lt;/P&gt;&lt;P&gt;5yrΔ+1.6%&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;DIV class="branch"&gt;&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been able to get the Greek delta into the output, but I have not been able to determine how to embed a character that will make the two values into one cell. Here is my code to make the data set, and I'm wondering if someone can point me toward a resource about how you merge (for lack of a better word) two values across two rows into one row when they share a common identifier (in this case, Graduation Rate).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
input year $4. order rate;
Metric='Graduation';
cards;
2007 1 0.750
2010 2 0.800
2011 3 0.815
;
run;

 data y1;
      set x;
	  if year in ('2010' '2011') then do;
             pctchng = dif(rate) / lag(rate) ; 
             period = '1yr'; 
	     output;
	  putlog year= order= rate= pctchng=;
	  end;
	  if year in ('2007' '2011') then do;
	     pctchng = dif(rate) / lag(rate) ; &lt;BR /&gt;  period = '5yr'; &lt;BR /&gt; output;
	  putlog year= order= rate= pctchng=;
	  end;
	run;&lt;BR /&gt;
data y1;
set y1;
if pctchng = . then delete;
run;&lt;BR /&gt;
data y1;
   set y1;
   Z= "(*ESC*){unicode delta_U}";
   format pctchng percent14.1;
   text_var = STRIP(PUT(pctchng, percent14.1));
   if pctchng &amp;gt; 0 then do;
      newvar = strip(period)||' '||Z||'+'||(text_var);
   end;
   else if pctchng &amp;lt; 0 then do;
      newvar = strip(period)||' '||Z||'-'||(text_var);
   end;
   else if pctchng = 0 then do; 
      newvar = strip(period)||' '||Z||(text_var);
	  end;
   keep Metric rate newvar;
	run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Mar 2018 17:19:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-Two-Values-Across-Two-Observations-Into-One-Value-in-One/m-p/447859#M283380</guid>
      <dc:creator>svh</dc:creator>
      <dc:date>2018-03-22T17:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Two Values Across Two Observations Into One Value in One Observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-Two-Values-Across-Two-Observations-Into-One-Value-in-One/m-p/448050#M283381</link>
      <description>&lt;P&gt;Have you looked at this paper?&lt;/P&gt;
&lt;P&gt;"Preserving Line Breaks When Exporting to Excel"&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.pharmasug.org/proceedings/2014/CC/PharmaSUG-2014-CC07.pdf" target="_blank"&gt;https://www.pharmasug.org/proceedings/2014/CC/PharmaSUG-2014-CC07.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 04:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-Two-Values-Across-Two-Observations-Into-One-Value-in-One/m-p/448050#M283381</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-03-23T04:16:31Z</dc:date>
    </item>
  </channel>
</rss>

