<?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 daily data from large file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712599#M219738</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114"&gt;@ciro&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Let me try to be more clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the original data, for each date from 1JAN2015 to 31DEC2016 I could calculate three variables like:&lt;/P&gt;
&lt;P&gt;n_start=(date=start);&lt;/P&gt;
&lt;P&gt;n_end=(date=end);&lt;/P&gt;
&lt;P&gt;n_active=(start le date le coalesce(end,'31DEC2099'd));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then:&lt;/P&gt;
&lt;P&gt;1.summarize all variables(=365*2*3) over the 40millions observations.&lt;/P&gt;
&lt;P&gt;2. transpose the resulting dataset in order to have a wanted dataset with (365*2*3) records identified by the date of the day and three variables&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was wondering whether there were other ways to do this and which is the quickest way to obtain the result.&lt;/P&gt;
&lt;P&gt;I hope it is clearer.&lt;/P&gt;
&lt;P&gt;Thank you very much in advance for any suggestion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Example. Actual data, actual find parameters, expected results&lt;/P&gt;
&lt;P&gt;The way you phrase this is VERY different than your initial question where you were listing starts and ends. This&lt;/P&gt;
&lt;PRE&gt;n_start=(date=start);&lt;/PRE&gt;
&lt;P&gt;Will create boolean values, 1 or 0. Is that what you expect for n_start?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if your 365 in the number of variables means you have a different variable for every day of the year then ugly ugly ugly data model for many things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jan 2021 07:08:54 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-01-20T07:08:54Z</dc:date>
    <item>
      <title>create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712432#M219652</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;i have a big dataset (about 40 millions obs) concerning some items.&lt;/P&gt;
&lt;P&gt;For each item I have a starting date and an end date (if the item has expired,otherwise it is missing).&lt;/P&gt;
&lt;P&gt;the data set is as following;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;id=1; start='1FEB2015'd; end=.;output;&lt;BR /&gt;id=2; start='1FEB2015'd; end='31JUL2015'd;output;&lt;BR /&gt;id=3; start='1SEP2015'd; end='31OCT2015'd;output;&lt;/P&gt;
&lt;P&gt;format start end date9.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need a dataset with a record per each day, say from 1 Jan 2015 to 31 dec 2016.&lt;/P&gt;
&lt;P&gt;for each day I need information on three variables (number of starts, number of ends and number of active items).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As the dataset is very big, is there any other way other than creating a flag (1/0)&amp;nbsp; for each day and each of the three variables (that is over 2000 variables)&amp;nbsp; and then summarize by days?&lt;/P&gt;
&lt;P&gt;I imagine I can partition the problem but what is a good way?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestion on the procedure to write, the coding to create this kind of variables,and how to summarize is much appreciated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 16:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712432#M219652</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2021-01-19T16:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712443#M219654</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;data have;&lt;BR /&gt;id=1; start='1FEB2015'd; end=.;output;&lt;BR /&gt;id=2; start='1FEB2015'd; end='31JUL2015'd;output;&lt;BR /&gt;id=3; start='1SEP2015'd; end='31OCT2015'd;output;&lt;/P&gt;
&lt;P&gt;format start end date9.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need a dataset with a record per each day, say from 1 Jan 2015 to 31 dec 2016.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;How does the sentence "I need a dataset with a record per each day, say from 1 Jan 2015 to 31 dec 2016" relate to the data provided above, where 31DEC2016 is not mentioned?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 16:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712443#M219654</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-19T16:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712459#M219658</link>
      <description>&lt;P&gt;You need to provide details on just how you need to compare Start and End with those two other values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have a number of cases to potentially address&lt;/P&gt;
&lt;P&gt;lowerlimit &amp;lt; start &amp;lt; end &amp;lt; upperlimit&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;= obviously complicated by end Missing&lt;/P&gt;
&lt;P&gt;lowerlimit &amp;lt; start &amp;nbsp; &amp;lt; upperlimit&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;= doesn't use end at all&lt;/P&gt;
&lt;P&gt;lowerlimit &amp;lt; end&amp;lt; upperlimit&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;= doesn't use start at all but the end missing is an issue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So describe in detail which of these you want and how the End=missing is to be treated&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 17:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712459#M219658</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-19T17:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712495#M219674</link>
      <description>&lt;P&gt;I hear&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;, something about this is unclear.&amp;nbsp; So lets start by saying why this code is good or bad.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data temp (Keep=date start	end);
  set have;
  /*do date="01Jan2015"d to "31dec2016"d; */

  *no,no,no. to keep the data sane let's do this... ;
  do date="01Feb2015"d,"31Jul2015"d,"01Aug2015"d,
          "31Aug2015"d,"01Sep2015"d,"31Oct2015"d,
          "01Nov2015"d;
    if start&amp;lt;=date  and (date&amp;lt;=end or missing(end)) then output;
  end;
  format date date9.;
run;

PROC SQL;
   CREATE TABLE want_ish AS  
   SELECT DISTINCT date, 
            (COUNT(start)) AS COUNT_of_start, 
            (COUNT(end)) AS COUNT_of_end, 
            (COUNT(start)) AS 'number active'n
      FROM TEMP 
      GROUP BY date;
QUIT;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Number active means number of starts.&amp;nbsp; It's to unclear, to me, what you're counting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="399"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="75"&gt;date&lt;/TD&gt;
&lt;TD width="107"&gt;COUNT_of_start&lt;/TD&gt;
&lt;TD width="103"&gt;COUNT_of_end&lt;/TD&gt;
&lt;TD width="114"&gt;number_active&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;01Feb2015&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;31Jul2015&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;01Aug2015&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;31Aug2015&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;01Sep2015&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;31Oct2015&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;01Nov2015&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 20:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712495#M219674</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-19T20:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712534#M219697</link>
      <description>&lt;P&gt;Let me try to be more clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the original data, for each date from 1JAN2015 to 31DEC2016 I could calculate three variables like:&lt;/P&gt;
&lt;P&gt;n_start=(date=start);&lt;/P&gt;
&lt;P&gt;n_end=(date=end);&lt;/P&gt;
&lt;P&gt;n_active=(start le date le coalesce(end,'31DEC2099'd));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then:&lt;/P&gt;
&lt;P&gt;1.summarize all variables(=365*2*3) over the 40millions observations.&lt;/P&gt;
&lt;P&gt;2. transpose the resulting dataset in order to have a wanted dataset with (365*2*3) records identified by the date of the day and three variables&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was wondering whether there were other ways to do this and which is the quickest way to obtain the result.&lt;/P&gt;
&lt;P&gt;I hope it is clearer.&lt;/P&gt;
&lt;P&gt;Thank you very much in advance for any suggestion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2021 22:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712534#M219697</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2021-01-19T22:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712599#M219738</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114"&gt;@ciro&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Let me try to be more clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the original data, for each date from 1JAN2015 to 31DEC2016 I could calculate three variables like:&lt;/P&gt;
&lt;P&gt;n_start=(date=start);&lt;/P&gt;
&lt;P&gt;n_end=(date=end);&lt;/P&gt;
&lt;P&gt;n_active=(start le date le coalesce(end,'31DEC2099'd));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then:&lt;/P&gt;
&lt;P&gt;1.summarize all variables(=365*2*3) over the 40millions observations.&lt;/P&gt;
&lt;P&gt;2. transpose the resulting dataset in order to have a wanted dataset with (365*2*3) records identified by the date of the day and three variables&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was wondering whether there were other ways to do this and which is the quickest way to obtain the result.&lt;/P&gt;
&lt;P&gt;I hope it is clearer.&lt;/P&gt;
&lt;P&gt;Thank you very much in advance for any suggestion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Example. Actual data, actual find parameters, expected results&lt;/P&gt;
&lt;P&gt;The way you phrase this is VERY different than your initial question where you were listing starts and ends. This&lt;/P&gt;
&lt;PRE&gt;n_start=(date=start);&lt;/PRE&gt;
&lt;P&gt;Will create boolean values, 1 or 0. Is that what you expect for n_start?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if your 365 in the number of variables means you have a different variable for every day of the year then ugly ugly ugly data model for many things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 07:08:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712599#M219738</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-20T07:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712621#M219740</link>
      <description>&lt;P&gt;the resulting dataset that I want is a dataset of aggregate data obtained by summing up the boolean values created in the micro data. it is like the one built by Philc .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my issue is how to build it starting from a very large dataset with an efficient procedure.&lt;/P&gt;
&lt;P&gt;hope this helps clarify.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 09:16:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712621#M219740</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2021-01-20T09:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712630#M219745</link>
      <description>&lt;P&gt;the following seems to work (on a smaller dataset).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have2;&lt;BR /&gt;set have;&lt;BR /&gt;do day='1JAN2015'd to '31DEC2016'd;&lt;BR /&gt;n_start=(day=start);&lt;BR /&gt;n_end=(day=end);&lt;BR /&gt;n_active=(start le day le coalesce(end,'31DEC2099'd));&lt;BR /&gt;end;&lt;BR /&gt;if n_active=1 then output;*to write on the disk occuping less space;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;proc means data=have2 nway noprint;&lt;BR /&gt;class day;&lt;BR /&gt;var n_start n_end n_active;&lt;BR /&gt;output out=want sum=;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;on 1000000 obs it takes about 5-6 minutes.&lt;/P&gt;
&lt;P&gt;however the disk space occupied seems a lot. Maybe I should partition the problem via a macro loop or something like that. any advice on this route?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 10:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712630#M219745</guid>
      <dc:creator>ciro</dc:creator>
      <dc:date>2021-01-20T10:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712632#M219747</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/114"&gt;@ciro&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Let me try to be more clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the original data, for each date from 1JAN2015 to 31DEC2016 I could calculate three variables like:&lt;/P&gt;
&lt;P&gt;n_start=(date=start);&lt;/P&gt;
&lt;P&gt;n_end=(date=end);&lt;/P&gt;
&lt;P&gt;n_active=(start le date le coalesce(end,'31DEC2099'd));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then:&lt;/P&gt;
&lt;P&gt;1.summarize all variables(=365*2*3) over the 40millions observations.&lt;/P&gt;
&lt;P&gt;2. transpose the resulting dataset in order to have a wanted dataset with (365*2*3) records identified by the date of the day and three variables&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was wondering whether there were other ways to do this and which is the quickest way to obtain the result.&lt;/P&gt;
&lt;P&gt;I hope it is clearer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Does not answer my question. Why are the dates being chosen to be 1JAN2015 to 31DEC2016, when you clearly presented data with other dates? And so because of this, the code you present is essentially meaningless.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 11:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712632#M219747</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-20T11:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712648#M219754</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
id=1; start='1FEB2015'd; end=.;output;
id=2; start='1FEB2015'd; end='31JUL2015'd;output;
id=3; start='1SEP2015'd; end='31OCT2015'd;output;
format start end yymmdd10.;
run;

data template;
format day yymmdd10.;
do day = '01jan2015'd to '31dec2016'd;
  output;
end;
run;

data active;
set have;
active = 1;
end = coalesce(end,'31dec2016'd);
do day = start to end;
  output;
end;
keep day active;
run;

proc summary data=active nway;
class day;
var active;
output out=actives (drop=_:) sum()=;
run;

proc summary data=have nway;
class start;
var id;
output out=starts (drop=_: rename=(id=starts start=day)) n()=;
run;

proc summary data=have nway;
class end;
var id;
output out=ends (drop=_: rename=(id=ends end=day)) n()=;
run;

data want;
merge
  template
  starts
  ends
  actives
;
by day;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The longest step should be the SUMMARY of dataset active.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 12:29:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712648#M219754</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-01-20T12:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: create daily data from large file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712678#M219771</link>
      <description>&lt;P&gt;Then I would change my solution to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp (Keep=date n_start n_end n_active );
  set have;
  /*do date="01Jan2015"d to "31dec2016"d;*/

  *but... just to keep the data sane let do this... ;
  do date="01Feb2015"d,"31Jul2015"d,"01Aug2015"d,
          "31Aug2015"d,"01Sep2015"d,"31Oct2015"d,
          "01Nov2015"d;
    if start&amp;lt;=date  and (date&amp;lt;=end or missing(end)) then do
       n_start=(date=start);
       n_end=(date=end);
       n_active=1;
       output;
    end;
  end;
  format date date9.;
run;

PROC SQL;
   CREATE TABLE want_ish AS 
   SELECT DISTINCT date, 
            (SUM(n_start)) AS COUNT_of_start, 
            (Sum(n_end)) AS COUNT_of_end, 
            (SUM(n_active)) AS COUNT_of_active
      FROM TEMP 
      GROUP BY date;
QUIT;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2021 13:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-daily-data-from-large-file/m-p/712678#M219771</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-20T13:43:52Z</dc:date>
    </item>
  </channel>
</rss>

