<?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: If multiple values within timeframe, then make a row of all these values from a long dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648942#M194496</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/323440"&gt;@andyec&lt;/a&gt;&amp;nbsp; My apologies, I overlooked something and that's very silly of me. First try this change and test in full and let me know if this works, and then I shall delve into your additional requirement. Sorry again&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select max(m) into :m trimmed
from (select count(grp) as m from temp group by id,grp);
quit;

%put &amp;amp;=m;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 May 2020 17:58:38 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-05-19T17:58:38Z</dc:date>
    <item>
      <title>If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648895#M194473</link>
      <description>&lt;P&gt;I'm working with a dataset of lab values, and if an ID has at least 2 lab values within 7 days of each other, I would like to create a row of those values and associated dates. That way, I can look at the rows that have non-missing value2, value3, etc. Please see a simulated dataset below and the dataset I would like to create.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 1. Have&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;obs&lt;/TD&gt;&lt;TD&gt;id&lt;/TD&gt;&lt;TD&gt;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D&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1500&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 19 May 2020 16:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648895#M194473</guid>
      <dc:creator>andyec</dc:creator>
      <dc:date>2020-05-19T16:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648911#M194480</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/323440"&gt;@andyec&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm="09"x;
	input obs id date:MMDDYY10. value;
	format date MMDDYY10.;
	datalines;
1	1	5/30/19	20
2	1	5/31/19	20
3	1	6/1/19	19
4	1	6/10/19	177
5	1	7/7/19	350
6	1	7/10/19	200
7	2	1/3/19	100
8	3	1/4/19	99
9	3	3/6/19	19
10	3	3/8/19	20
11	3	12/8/19	1500
;
run;

data have_flag;
	do i=1 until(last.id);
		set have;
		format date7 MMDDYY10.;
		by id;
		retain date7;
		if first.id then date7 = date;
		if date-date7 &amp;gt; 7 then date7 = date;
	end;
run;

proc transpose data=have_flag out=have_tr1 prefix=date;
	var date;
	by id date7;
run;

proc transpose data=have_flag out=have_tr2 prefix=value;
	var value;
	by id date7;
run;

data want;
	merge have_tr1 have_tr2;
	by id date7;
	drop _name_ date7;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2020-05-19 à 18.28.37.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39591iED1793A3058374E4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-05-19 à 18.28.37.png" alt="Capture d’écran 2020-05-19 à 18.28.37.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 16:28:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648911#M194480</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-19T16:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648919#M194485</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/323440"&gt;@andyec&lt;/a&gt;&amp;nbsp; The idea is basically to group the intervals and transpose the contents of the group to wide structure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
	infile datalines ;
	input obs id date:MMDDYY10. value;
	format date MMDDYY10.;
	drop obs;
	datalines;
1	1	5/30/19	20
2	1	5/31/19	20
3	1	6/1/19	19
4	1	6/10/19	177
5	1	7/7/19	350
6	1	7/10/19	200
7	2	1/3/19	100
8	3	1/4/19	99
9	3	3/6/19	19
10	3	3/8/19	20
11	3	12/8/19	1500
;
run;

data temp;
 set have;
 by id;
 if dif(date)&amp;gt;7 then grp+1;
 if first.id then grp=1;
run;

proc sql noprint;
select max(m) into :m trimmed
from (select max(grp) as m from temp group by id);
quit;

%put &amp;amp;=m;

data want;
 do _n_= 1 by 1 until(last.grp);
  set temp;
  by id grp;
  array dt  date1-date&amp;amp;m;
  array v value1-value&amp;amp;m;
  dt(_n_)=date;
  v(_n_)=value;
 end;
 format date: mmddyy10.;
 drop date value grp;
run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 May 2020 18:24:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648919#M194485</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-19T18:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648933#M194489</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt;&amp;nbsp;and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;thank you very much for your replies. I was able to get both to work with the simulated data provided.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;when I use your code on the real dataset, I get an excessive number of value and date variables, and it seems to be the maximum amount of times an ID appears (not the maximum amount of times an ID appears to have a certain amount of values within 7 days). Any idea why this might be?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly, I was wondering how I would add in one more additional variable that corresponds to every value. The variable is psource and can be seen in this post &lt;LI-MESSAGE title="Count number of times within a timeframe by id, multiple occurrences by id possible" uid="640479" url="https://communities.sas.com/t5/SAS-Programming/Count-number-of-times-within-a-timeframe-by-id-multiple/m-p/640479#U640479" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&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 May 2020 17:23:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648933#M194489</guid>
      <dc:creator>andyec</dc:creator>
      <dc:date>2020-05-19T17:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648936#M194491</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/323440"&gt;@andyec&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would the additional variable&amp;nbsp;&lt;SPAN&gt;psource be&amp;nbsp;splitted in psource1, psource2, psource3 as well?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 17:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648936#M194491</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-19T17:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648938#M194493</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292097"&gt;@ed_sas_member&lt;/a&gt; that's what I'm aiming for.</description>
      <pubDate>Tue, 19 May 2020 17:43:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648938#M194493</guid>
      <dc:creator>andyec</dc:creator>
      <dc:date>2020-05-19T17:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648941#M194495</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/323440"&gt;@andyec&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have added a proc transpose step at the end of the program, just before the merge:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have_flag;
	do i=1 until(last.id);
		set have;
		format date7 MMDDYY10.;
		by id;
		retain date7;
		if first.id then date7 = date;
		if date-date7 &amp;gt; 7 then date7 = date;
	end;
run;

proc transpose data=have_flag out=have_tr1 prefix=date;
	var date;
	by id date7;
run;

proc transpose data=have_flag out=have_tr2 prefix=value;
	var value;
	by id date7;
run;

proc transpose data=have_flag out=have_tr3 prefix=psource;
	var psource;
	by id date7;
run;

data want;
	merge have_tr1 have_tr2 have_tr3;
	by id date7;
	drop _name_ date7;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 17:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648941#M194495</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-19T17:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648942#M194496</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/323440"&gt;@andyec&lt;/a&gt;&amp;nbsp; My apologies, I overlooked something and that's very silly of me. First try this change and test in full and let me know if this works, and then I shall delve into your additional requirement. Sorry again&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select max(m) into :m trimmed
from (select count(grp) as m from temp group by id,grp);
quit;

%put &amp;amp;=m;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 May 2020 17:58:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648942#M194496</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-19T17:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648972#M194504</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; no problem - that fixes it.</description>
      <pubDate>Tue, 19 May 2020 18:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648972#M194504</guid>
      <dc:creator>andyec</dc:creator>
      <dc:date>2020-05-19T18:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: If multiple values within timeframe, then make a row of all these values from a long dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648976#M194505</link>
      <description>&lt;P&gt;Okay good&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/323440"&gt;@andyec&lt;/a&gt;&amp;nbsp; Are you able to modify the code to get the additional variables too. Methinks, another array and assignment statement like the following should do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array p psource1-psource&amp;amp;m;
p(_n_)=psource;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should do. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 18:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-multiple-values-within-timeframe-then-make-a-row-of-all-these/m-p/648976#M194505</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-05-19T18:54:54Z</dc:date>
    </item>
  </channel>
</rss>

