<?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: SAS Data Visualization (Three 4x4 matrices) in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SAS-Data-Visualization-Three-4x4-matrices/m-p/100522#M3747</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hard to say, but maybe you can plot a 4x4 matrix using a GTL LAYOUT LATTICE to define a 4x4 matrix of SERIES plot with day on x axis, and mean values on y axis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 09 Jun 2013 10:46:38 GMT</pubDate>
    <dc:creator>Jay54</dc:creator>
    <dc:date>2013-06-09T10:46:38Z</dc:date>
    <item>
      <title>SAS Data Visualization (Three 4x4 matrices)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-Data-Visualization-Three-4x4-matrices/m-p/100521#M3746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0px 0px 1em; font-size: 14px; background-color: #ffffff; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;I need some advice about how to represent the following data. The code is lengthy, but i've tested it and it works well to create random data for this sample.&lt;/P&gt;&lt;P style="margin: 0px 0px 1em; font-size: 14px; background-color: #ffffff; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;I want to represent the difference in mean stake from Day 1 - Day 3 i.e. the difference in the mean of the variables day1TotalStake, day2TotalStake and day3TotalStakeAll. All I've done at the end of the code below is call a 'proc means' on those three variables and I also tried a 'proc tabulate' on one of those variables: day1TotalStake to see the distribution by stake quartile and return quartile for the first day only. I need some way of showing how the mean value in each quartile of that matrix changes over the next two days.&lt;/P&gt;&lt;P style="margin: 0px 0px 1em; font-size: 14px; background-color: #ffffff; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;There is quite a lot of data and eyeballing it in table format is not working. A clever data visualization technique of some kind would nail the representation of the data much better than a very verbose table. I was thinking of some kind of heat map or a graph of some kind but , but have no idea how that would show changes over time i.e. what happens to the value in cell (0,0) on day1, day2 and day3.&lt;/P&gt;&lt;P style="margin: 0px 0px 1em; font-size: 14px; background-color: #ffffff; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;I'd appreciate any pointers at all on this.&lt;/P&gt;&lt;P style="margin: 0px 0px 1em; font-size: 14px; background-color: #ffffff; color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;Thanks.&lt;/P&gt;&lt;P&gt;* This greats a series of rows at random;&lt;/P&gt;&lt;P&gt;data random(keep=date timestamp username stake price winlose winnings);&lt;/P&gt;&lt;P&gt;call streaminit(123); /* set random number seed */&lt;/P&gt;&lt;P&gt;format timestamp datetime.;&lt;/P&gt;&lt;P&gt;format date date9.;&lt;/P&gt;&lt;P&gt;NRows = 1000;MinStake = 0.01;MaxStake = 10;Betprice = 1.83;StartDate = MDY(1,1,2020);DateRange=100;OpeningHour=8;ClosingHour=15;MaxCustomers=1000;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i = 1 to NRows;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; u = rand("Uniform");&amp;nbsp;&amp;nbsp;&amp;nbsp; /* U[0,1] */&lt;/P&gt;&lt;P&gt;&amp;nbsp; date = StartDate+floor(ranuni(0)*DateRange);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timestamp = DHMS(date,OpeningHour + floor((1+ClosingHour-0)*u),0 + floor((1+59-0)*u),0 + floor((1+59-0)*u));&lt;/P&gt;&lt;P&gt;&amp;nbsp; username = cat("player", 1 + floor((1+MaxCustomers-1)*u));&lt;/P&gt;&lt;P&gt;&amp;nbsp; stake = floor( (MinStake+MaxStake)*u ) * 10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; price = betprice;&lt;/P&gt;&lt;P&gt;&amp;nbsp; winlose=rand('BERN',.50);&lt;/P&gt;&lt;P&gt;&amp;nbsp; winnings = winlose * Betprice * stake;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;* This sort is necessary for the next data step;&lt;/P&gt;&lt;P&gt;proc sort data=random;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by username timestamp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;* This data step calculates a number of variables on the fly;&lt;/P&gt;&lt;P&gt;data random;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set random;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by username date timestamp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; retain calendarTime eventTime;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.username then calendarTime = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.date then calendarTime + 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.username then eventTime = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.timestamp then eventTime + 1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;* This creates an aggregate table to enable functions like 'proc freq' to be run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table randomAggregate as &lt;/P&gt;&lt;P&gt;&amp;nbsp; select &lt;/P&gt;&lt;P&gt;&amp;nbsp; username,&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(case when calendarTime =1 then stake else . End) as day1TotalStake,&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(case when calendarTime =1 then winnings - stake else . End) as day1TotalWinnings,&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(case when calendarTime =1 then winnings - stake else . End)/sum(case when calendarTime =1 then stake else . End)as day1AverageReturn,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(case when calendarTime =2 then stake else . End) as day2TotalStake,&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(case when calendarTime =2 then winnings - stake else . End) as day2TotalWinnings,&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(case when calendarTime =2 then winnings - stake else . End)/sum(case when calendarTime =2 then stake else . End)as day2AverageReturn,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(case when calendarTime =3 then stake else . End) as day3TotalStake,&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(case when calendarTime =3 then winnings - stake else . End) as dasy3TotalWinnings,&lt;/P&gt;&lt;P&gt;&amp;nbsp; sum(case when calendarTime =3 then winnings - stake else . End)/sum(case when calendarTime =3 then stake else . End)as day3AverageReturn&lt;/P&gt;&lt;P&gt;&amp;nbsp; from random&lt;/P&gt;&lt;P&gt;&amp;nbsp; group by username;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;* This adds the quartile flags;&lt;/P&gt;&lt;P&gt;Proc rank data=randomAggregate ties=mean out=randomRanked groups=4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var day1TotalStake day1AverageReturn day2TotalStake day2AverageReturn;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ranks day1TotalStakeQuartile day1AverageReturnQuartile day2TotalStakeQuartile day2AverageReturnQuartile;&lt;/P&gt;&lt;P&gt;&amp;nbsp; LABEL day1TotalStakeQuartile = 'day1TotalStakeQ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; LABEL day1AverageReturnQuartile = 'day1AverageReturnQ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; LABEL day2TotalStakeQuartile = 'day2TotalStakeQ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; LABEL day2AverageReturnQuartile = 'day2AverageReturnQ';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;*This prints out the count and stats for each cell in the matrix in list format for the first THREE days;&lt;/P&gt;&lt;P&gt;proc means data = randomRanked nmiss mean MAXDEC=2; &lt;/P&gt;&lt;P&gt;&amp;nbsp; var day1TotalStake day2TsotalStake day3TotalStake; &lt;/P&gt;&lt;P&gt;&amp;nbsp; class day1TotalStakeQuartile day1AverageReturnQuartile;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* This shows the sum and mean at the end of Day 1 in MATRIX format;&lt;/P&gt;&lt;P&gt;* it only shows the TOTAL stake: not the mean;&lt;/P&gt;&lt;P&gt;proc tabulate data=randomRanked noseps missing;&lt;/P&gt;&lt;P&gt;&amp;nbsp; class day1AverageReturnQuartile day1TotalStakeQuartile;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var day1TotalStake;&lt;/P&gt;&lt;P&gt;&amp;nbsp; table day1TotalStakeQuartile= "Stake Quartile", day1TotalStake*day1AverageReturnQuartile="AverageReturn Quartile"*sum;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Jun 2013 22:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-Data-Visualization-Three-4x4-matrices/m-p/100521#M3746</guid>
      <dc:creator>tobriain</dc:creator>
      <dc:date>2013-06-08T22:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Data Visualization (Three 4x4 matrices)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-Data-Visualization-Three-4x4-matrices/m-p/100522#M3747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hard to say, but maybe you can plot a 4x4 matrix using a GTL LAYOUT LATTICE to define a 4x4 matrix of SERIES plot with day on x axis, and mean values on y axis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Jun 2013 10:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-Data-Visualization-Three-4x4-matrices/m-p/100522#M3747</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2013-06-09T10:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Data Visualization (Three 4x4 matrices)</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-Data-Visualization-Three-4x4-matrices/m-p/100523#M3748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great: thanks for that. Any idea how I might be able to compare the three matrices themselves? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Jun 2013 14:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-Data-Visualization-Three-4x4-matrices/m-p/100523#M3748</guid>
      <dc:creator>tobriain</dc:creator>
      <dc:date>2013-06-09T14:04:29Z</dc:date>
    </item>
  </channel>
</rss>

