<?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: Create a table with values dependent on other variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809031#M319022</link>
    <description>&lt;P&gt;Sorry, report then. That is exactly what I wanted, thanks.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Apr 2022 12:26:17 GMT</pubDate>
    <dc:creator>Louis_DB</dc:creator>
    <dc:date>2022-04-21T12:26:17Z</dc:date>
    <item>
      <title>Create a table with values dependent on other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/808983#M319003</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a table that shows values from one column dependent on values from other columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hypothetical dataset:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;                    
	input MARKET_ID $ date_formatted $ labelet per_dateg_market_label;  
	datalines;            
AQE-MAIN 11APR22 1 5 
AQE-MAIN 11APR22 2 2 
AQE-MAIN 11APR22 3 434 
AQE-MAIN 12APR22 1 2 
AQE-MAIN 12APR22 2 2 
AQE-MAIN 12APR22 3 425 
CPH-MAIN 11APR22 1 9 
CPH-MAIN 11APR22 2 6 
CPH-MAIN 11APR22 3 774 
CPH-MAIN 12APR22 1 12 
CPH-MAIN 12APR22 2 10 
CPH-MAIN 12APR22 3 784 
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What I want to create, is a table, where on the vertical axis there would be the "MARKET_ID" followed by the 3 different "labelet" and on the horizontal axis would be the "date_formatted". The values would then be the the corresponding values from "per_dateg_market_label".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My idea was to use proc tabulate and do something like this (although not working):&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc tabulate data=work.have order=data format=comma18.2;
	class MARKET_ID date_formatted;
	var labelet per_dateg_market_label;
	table MARKET_ID='Venue' * labelet, date_formatted=' ' * per_dateg_market_label;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;any help is appreciated (new to sas)&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 09:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/808983#M319003</guid>
      <dc:creator>Louis_DB</dc:creator>
      <dc:date>2022-04-21T09:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with values dependent on other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809003#M319008</link>
      <description>&lt;P&gt;Start by restoring "date_formatted" to be a sas date again. String dates will appear in the expected order only, if the format YYYY-MM-DD is used.&lt;/P&gt;
&lt;P&gt;Also please explain what "not working" means in your case.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 10:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809003#M319008</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-04-21T10:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with values dependent on other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809011#M319014</link>
      <description>&lt;P&gt;Are you after a table or a report? If it's a table is below what you want?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input MARKET_ID $ date_formatted:date9. labelet per_dateg_market_label;
  format date_formatted date9.;
  datalines;
AQE-MAIN 11APR22 1 5 
AQE-MAIN 11APR22 2 2 
AQE-MAIN 11APR22 3 434 
AQE-MAIN 12APR22 1 2 
AQE-MAIN 12APR22 2 2 
AQE-MAIN 12APR22 3 425 
CPH-MAIN 11APR22 1 9 
CPH-MAIN 11APR22 2 6 
CPH-MAIN 11APR22 3 774 
CPH-MAIN 12APR22 1 12 
CPH-MAIN 12APR22 2 10 
CPH-MAIN 12APR22 3 784 
;

proc transpose data=have out=want(drop=_:) prefix=labelet_;
  by market_id date_formatted;
  id labelet;
  var per_dateg_market_label;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1650539822741.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70665iD2F33CAC12197E82/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1650539822741.png" alt="Patrick_0-1650539822741.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 11:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809011#M319014</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-04-21T11:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with values dependent on other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809012#M319015</link>
      <description>&lt;P&gt;Hi Patrick,&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a table that i want (later on i want to print it as an image).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want it to look like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11APR22&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12APR22&lt;/P&gt;&lt;P&gt;AQE-MAIN 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;434&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;425&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;CPH-MAIN 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;774&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;784&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 11:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809012#M319015</guid>
      <dc:creator>Louis_DB</dc:creator>
      <dc:date>2022-04-21T11:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with values dependent on other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809025#M319019</link>
      <description>&lt;P&gt;That's a report and not a table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below Proc Tabulate uses the sample data as posted previously (with&amp;nbsp;date_formatted being a numerical variable containing a SAS Date value and with format date9. applied).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=have noseps;
  class market_id date_formatted labelet;
  var per_dateg_market_label;
  keylabel sum=' ';
  table 
    market_id=' '*labelet=' ',
    date_formatted=' '*per_dateg_market_label=' '*f=32.
    ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1650543256029.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70669iBA8E5D345A083D31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1650543256029.png" alt="Patrick_0-1650543256029.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 12:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809025#M319019</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-04-21T12:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with values dependent on other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809031#M319022</link>
      <description>&lt;P&gt;Sorry, report then. That is exactly what I wanted, thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 12:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809031#M319022</guid>
      <dc:creator>Louis_DB</dc:creator>
      <dc:date>2022-04-21T12:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create a table with values dependent on other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809044#M319028</link>
      <description>&lt;P&gt;The following certainly not the correct "scientific" definition but as a made-up "rule of thumb": A table is the object that holds your data (like the &lt;EM&gt;have&lt;/EM&gt; table), a report is the object you create to surface/print this data in the way you want to look at it.&lt;/P&gt;
&lt;P&gt;A SAS table is always rectangular.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 13:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-table-with-values-dependent-on-other-variables/m-p/809044#M319028</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-04-21T13:02:08Z</dc:date>
    </item>
  </channel>
</rss>

