<?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: Add a column with line graph and indicator in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Add-a-column-with-line-graph-and-indicator/m-p/628696#M185816</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/206798"&gt;@nickspencer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the following material could be a great resource:&amp;nbsp;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/116-31.pdf" target="_self"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/116-31.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hereafter is an example of a possible output.&lt;/P&gt;
&lt;P&gt;Hope this helps&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;Best,&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;ods excel file="/path/retail_dashboard.xlsx";

data retail;
	set sashelp.retail (keep=date sales);
	_lag_sales = lag(sales);
	year = year(date);
	month = month(date);
run;
	
proc report data=retail nowd;
	column year month sales _lag_sales Sales_ind Sales_month;
	define year 	   / group;
	define month 	   / group;
	define sales	   / display format=dollar8.2;
	define _lag_sales  / display noprint;
	define Sales_ind   / computed;
	define Sales_month / computed;

	/*Sales_ind: colored circle (red, yellow or green) based on current month sales */
	compute Sales_ind / character;
		if 0   &amp;lt;= sales &amp;lt; 500 then do; /* determine the threshold */
			Sales_ind ="O";
			call define(_col_, 'style', 'style=[foreground=red font_weight=bold');
		end;
		else if 500 &amp;lt;= sales &amp;lt; 800 then do; /* determine the threshold */
			Sales_ind ="O";
			call define(_col_, 'style', 'style=[foreground=yellow font_weight=bold');
		end;
		else if 800 &amp;lt;= sales then do; /* determine the threshold */
			Sales_ind ="O";
			call define(_col_, 'style', 'style=[foreground=green font_weight=bold]');
		end;
	endcomp;

	/*Sales_month should have a little line graph to show the sales increase or decrease over month.*/
	compute Sales_month / character;
		if Sales &amp;lt; _lag_sales then do;
			Sales_month="➘";
			call define(_col_, 'style', 'style=[foreground=red font_weight=bold ');
		end;
		if Sales = _lag_sales then do;
			Sales_month="➙";
			call define(_col_, 'style', 'style=[foreground=yellow font_weight=bold');
		end;
		if Sales &amp;gt; _lag_sales then do;
			Sales_month="➚";
			call define(_col_, 'style', 'style=[foreground=green font_weight=bold');
		end;
	endcomp;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Mar 2020 07:11:36 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-03-03T07:11:36Z</dc:date>
    <item>
      <title>Add a column with line graph and indicator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-a-column-with-line-graph-and-indicator/m-p/628626#M185785</link>
      <description>I am doing this in an excel but want to automate using SAS. I have a dataset with sales over month. I want to create two new columns. One called sales_mth and another sales_ind.&lt;BR /&gt;Sales_month should have a little line graph to show the sales increase or decrease over month. Sales_ind should have colored circle (red, yellow or green ) based on current month sales.&lt;BR /&gt;And finally export that to excel.&lt;BR /&gt;Is that possible to achieve two columns with SAS?&lt;BR /&gt;&lt;BR /&gt;If so, how can I do that.&lt;BR /&gt;&lt;BR /&gt;Hope the question makes sense.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Nick</description>
      <pubDate>Mon, 02 Mar 2020 01:08:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-a-column-with-line-graph-and-indicator/m-p/628626#M185785</guid>
      <dc:creator>nickspencer</dc:creator>
      <dc:date>2020-03-02T01:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add a column with line graph and indicator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-a-column-with-line-graph-and-indicator/m-p/628696#M185816</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/206798"&gt;@nickspencer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the following material could be a great resource:&amp;nbsp;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/116-31.pdf" target="_self"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/116-31.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hereafter is an example of a possible output.&lt;/P&gt;
&lt;P&gt;Hope this helps&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;Best,&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;ods excel file="/path/retail_dashboard.xlsx";

data retail;
	set sashelp.retail (keep=date sales);
	_lag_sales = lag(sales);
	year = year(date);
	month = month(date);
run;
	
proc report data=retail nowd;
	column year month sales _lag_sales Sales_ind Sales_month;
	define year 	   / group;
	define month 	   / group;
	define sales	   / display format=dollar8.2;
	define _lag_sales  / display noprint;
	define Sales_ind   / computed;
	define Sales_month / computed;

	/*Sales_ind: colored circle (red, yellow or green) based on current month sales */
	compute Sales_ind / character;
		if 0   &amp;lt;= sales &amp;lt; 500 then do; /* determine the threshold */
			Sales_ind ="O";
			call define(_col_, 'style', 'style=[foreground=red font_weight=bold');
		end;
		else if 500 &amp;lt;= sales &amp;lt; 800 then do; /* determine the threshold */
			Sales_ind ="O";
			call define(_col_, 'style', 'style=[foreground=yellow font_weight=bold');
		end;
		else if 800 &amp;lt;= sales then do; /* determine the threshold */
			Sales_ind ="O";
			call define(_col_, 'style', 'style=[foreground=green font_weight=bold]');
		end;
	endcomp;

	/*Sales_month should have a little line graph to show the sales increase or decrease over month.*/
	compute Sales_month / character;
		if Sales &amp;lt; _lag_sales then do;
			Sales_month="➘";
			call define(_col_, 'style', 'style=[foreground=red font_weight=bold ');
		end;
		if Sales = _lag_sales then do;
			Sales_month="➙";
			call define(_col_, 'style', 'style=[foreground=yellow font_weight=bold');
		end;
		if Sales &amp;gt; _lag_sales then do;
			Sales_month="➚";
			call define(_col_, 'style', 'style=[foreground=green font_weight=bold');
		end;
	endcomp;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 07:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-a-column-with-line-graph-and-indicator/m-p/628696#M185816</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-03-03T07:11:36Z</dc:date>
    </item>
  </channel>
</rss>

