<?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: How to &amp;quot;compress&amp;quot; a dataset in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421155#M27101</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dlm=',' dsd truncover;
input customer $ (date1-date3) (:mmddyy8.);
format date1-date3 mmddyy10.;
cards;
A,,01/01/17 
A,,,01/02/17
A,01/03/17
A,01/04/17
B,01/01/17
B,,,02/01/17
;
run;
data want;
 update have(obs=0) have;
 by customer;
 if last.customer or nmiss(of date:)=0 then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 14 Dec 2017 12:48:49 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-12-14T12:48:49Z</dc:date>
    <item>
      <title>How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421097#M27091</link>
      <description>&lt;P&gt;Hi Guru's&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Enterprise Guide my dataset looks like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&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; Date1&amp;nbsp;&amp;nbsp;&amp;nbsp; Date2&amp;nbsp;&amp;nbsp;&amp;nbsp; Date3&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01/01/17&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A &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;&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; 01/02/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01/03/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/04/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01/01/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;B&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;&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; 02/01/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;I want to "compress" the dataset to this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&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; Date1&amp;nbsp;&amp;nbsp;&amp;nbsp; Date2&amp;nbsp;&amp;nbsp;&amp;nbsp; Date3&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&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;01/03/17&amp;nbsp;01/01/17&amp;nbsp;01/02/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01/04/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/01/17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 02/01/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;or alternative:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&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; Date1&amp;nbsp;&amp;nbsp;&amp;nbsp; Date2&amp;nbsp;&amp;nbsp;&amp;nbsp; Date3&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01/03/17&amp;nbsp;01/01/17&amp;nbsp;01/02/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;01/04/17 01/01/17 01/02/17&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="Courier New"&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/01/17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 02/01/17&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Any good ideas?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;/Ole&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 07:11:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421097#M27091</guid>
      <dc:creator>obertel</dc:creator>
      <dc:date>2017-12-14T07:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421099#M27092</link>
      <description>What does the dates mean?&lt;BR /&gt;Why are they stored like that?&lt;BR /&gt;And what would your new structure tell from a business perspective?</description>
      <pubDate>Thu, 14 Dec 2017 07:13:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421099#M27092</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-12-14T07:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421100#M27093</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's some business context (very simplified)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date1 = Date for received phone call&lt;/P&gt;&lt;P&gt;Date2 = Date for outgoing phone call&lt;/P&gt;&lt;P&gt;Date3 = Date for received email&lt;/P&gt;&lt;P&gt;A = Customer A&lt;/P&gt;&lt;P&gt;B = Customer B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dates are SAS dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Ole&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 07:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421100#M27093</guid>
      <dc:creator>obertel</dc:creator>
      <dc:date>2017-12-14T07:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421104#M27094</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/176410"&gt;@obertel&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;From a data organisation point of view it would be much better to re-structure your data like {customer, date, type}.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that an option for you and if yes do you need help with the code for that?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 08:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421104#M27094</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-12-14T08:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421107#M27095</link>
      <description>&lt;P&gt;I'd much rather have the fields customer, date and comm_type, where comm_type has values for incoming/outgoing call, received/sent email, and so on. A new communication type won't need an expansion of the structure, everything is done via data.&lt;/P&gt;
&lt;P&gt;As a side-effect, you will always (by sorting by date) have a clear picture of the history of a customer; the wide format will quite effectively prevent that.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 08:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421107#M27095</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-14T08:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421110#M27096</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no problem structuring the data in customer, type and date.&lt;/P&gt;&lt;P&gt;The challenge is the presentation layer, where&amp;nbsp;I want to present the dates of three specific types in columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Ole&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 08:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421110#M27096</guid>
      <dc:creator>obertel</dc:creator>
      <dc:date>2017-12-14T08:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421126#M27098</link>
      <description>&lt;P&gt;Using your original structure for an example, the following should do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dlm=',' dsd truncover;
input customer $ (date1-date3) (:mmddyy8.);
format date1-date3 mmddyy10.;
cards;
A,,01/01/17 
A,,,01/02/17
A,01/03/17
A,01/04/17
B,01/01/17
B,,,02/01/17
;
run;

data
  date1 (keep=customer date1)
  date2 (keep=customer date2)
  date3 (keep=customer date3)
;
set have;
if date1 ne . then output date1;
if date2 ne . then output date2;
if date3 ne . then output date3;
run;

data want;
if _n_ = 0 then set have; * this does nothing except defining the variables, so that "of _all_" in the next line works;
call missing(of _all_); 
merge
  date1
  date2
  date3
;
by customer;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Dec 2017 09:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421126#M27098</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-14T09:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421132#M27099</link>
      <description>&lt;P&gt;What is your presentation layer?&lt;/P&gt;
&lt;P&gt;Most tools/many SAS PROCs have ability to to cross tabulation using categorical values (but you don't seem to have any measures, this is more of a list?).&lt;/P&gt;
&lt;P&gt;Also, even if you are transposing up the values on date category, you'll stil don't have a clear key in the table, and your result table with have an unclear structure/granularity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 10:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421132#M27099</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-12-14T10:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421144#M27100</link>
      <description>&lt;P&gt;Hi Kurt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution works perfect. Though, I had to sort date1, date2 and date3 dataset before the&amp;nbsp;merge.&lt;/P&gt;&lt;P&gt;Thank you for your help and thanks to all for your input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Ole&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 11:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421144#M27100</guid>
      <dc:creator>obertel</dc:creator>
      <dc:date>2017-12-14T11:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to "compress" a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421155#M27101</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dlm=',' dsd truncover;
input customer $ (date1-date3) (:mmddyy8.);
format date1-date3 mmddyy10.;
cards;
A,,01/01/17 
A,,,01/02/17
A,01/03/17
A,01/04/17
B,01/01/17
B,,,02/01/17
;
run;
data want;
 update have(obs=0) have;
 by customer;
 if last.customer or nmiss(of date:)=0 then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Dec 2017 12:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-quot-compress-quot-a-dataset/m-p/421155#M27101</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-12-14T12:48:49Z</dc:date>
    </item>
  </channel>
</rss>

