[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: creating event date
From:       Stanford Mwasongwe <smwasongwe () GMAIL ! COM>
Date:       2020-10-31 22:14:43
Message-ID: CAAfzsF6-RFjwczim4P=Qu6CeAPJnxBM0=KTS1RbQ1zdyi46UKw () mail ! gmail ! com
[Download RAW message or body]

Thanks Nat, nice do over!
*Stanford*



On Fri, Oct 30, 2020 at 2:11 PM Nat Wooding <
00000a500572f1ba-dmarc-request@listserv.uga.edu> wrote:

> A solution with a few more lines, some of which are not actually needed.
>
> Nat
>
> data Have;
> informat InvestigationID $10. colldate InvDate OnsetDate ReferDate DxDate EventDate
> MMddyy10.;
>   format                    colldate InvDate OnsetDate ReferDate DxDate EventDate
> MMddyy10.;
> input  InvestigationID colldate InvDate OnsetDate ReferDate DxDate
> EventDate;
> retain CovidDate   '01JAN2020'd;
> drop coviddate;
> array able colldate InvDate OnsetDate ReferDate DxDate EventDate;
> Do over able;
> if able le coviddate then able = .;
> end;
> format eventdate mmddyy10.;
> EventDate = min(CollDate,InvDate, OnsetDate, ReferDate, DxDate);
> put eventdate =;
>
> cards;
> 10821051 10/15/2020 10/21/2020 10/30/1993 . 10/15/2020 10/30/1993
> run;
> run;
>
>
>
>
> On Friday, October 30, 2020, 11:54:08 AM EDT, Joe Matise <
> snoopy369@gmail.com> wrote:
>
>
> There isn't a perfectly trivial way to do this, unfortunately, other than
> just cleaning the individual values.  Something like this is technically
> possible in one line, but, messy.
>
> coviddate = '01JAN2020'd;
> eventdate = min (
>   ifn(colldate gt coviddate, collate, .),
>   ifn(invdate gt coviddate, invdate, .),
>   ifn(onsetdate gt coviddate, onsetdate, .),
> ...
> );
>
> You could do that in a macro of course:
>
> %macro aftercovid(var=);
>   ifn(&var. gt coviddate, &var., .)
> %mend aftercovid;
>
> eventdate = min (%aftercovid(var=colldate), %aftercovid(var=invdate), ...
> );
>
> -Joe
>
> On Fri, Oct 30, 2020 at 10:00 AM Stanford Mwasongwe <smwasongwe@gmail.com>
> wrote:
>
> Hi everyone
> I am creating an eventdate with the following line
> EventDate = min(CollDate,InvDate, OnsetDate, ReferDate, DxDate);
> from time to time I come across things like this
> InvestigationIDcolldateInvDateOnsetDateReferDateDxDateEventDate
> 10821051 10/15/2020 10/21/2020 10/30/1993 . 10/15/2020 10/30/1993
> since the onset date is the earliest, it is selected as the eventdate, the
> only problem covid-19 was't around in that date..1993. How do I code these
> four hierarchy dates without selecting any date that is pre covid? Thanks
> for the help
> *Stanford*
>
>

[Attachment #3 (text/html)]

<div dir="ltr"><div class="gmail_default" \
style="font-family:verdana,sans-serif">Thanks Nat, nice do over!</div><div><div \
dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div \
dir="ltr"><div><span style="font-size:x-small"><font size="2"><font><span \
style="font-size:10pt"><font face="bookman old style, new york, times, serif" \
color="#444444"><b>Stanford</b></font></span></font></font></span></div><div><br></div></div></div></div><br></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 30, 2020 at 2:11 PM \
Nat Wooding &lt;<a href="mailto:00000a500572f1ba-dmarc-request@listserv.uga.edu">00000a500572f1ba-dmarc-request@listserv.uga.edu</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div \
style="font-family:&quot;Helvetica \
Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px"><div></div>  <div dir="ltr">A \
solution with a few more lines, some of which are not actually needed.</div><div \
dir="ltr"><br></div><div dir="ltr">Nat</div><div dir="ltr"><br></div><div \
dir="ltr"><div><div>data Have;</div><div>informat InvestigationID $10. <span \
style="white-space:pre-wrap">	</span>colldate<span \
style="white-space:pre-wrap">	</span>InvDate<span \
style="white-space:pre-wrap">	</span>OnsetDate<span \
style="white-space:pre-wrap">	</span>ReferDate<span \
style="white-space:pre-wrap">	</span>DxDate<span \
style="white-space:pre-wrap">	</span>EventDate MMddyy10.;</div><div>   format         \
<span style="white-space:pre-wrap">	</span>colldate<span \
style="white-space:pre-wrap">	</span>InvDate<span \
style="white-space:pre-wrap">	</span>OnsetDate<span \
style="white-space:pre-wrap">	</span>ReferDate<span \
style="white-space:pre-wrap">	</span>DxDate<span \
style="white-space:pre-wrap">	</span>EventDate MMddyy10.;</div><div>input   \
InvestigationID<span style="white-space:pre-wrap">	</span>colldate<span \
style="white-space:pre-wrap">	</span>InvDate<span \
style="white-space:pre-wrap">	</span>OnsetDate<span \
style="white-space:pre-wrap">	</span>ReferDate<span \
style="white-space:pre-wrap">	</span>DxDate<span \
style="white-space:pre-wrap">	</span>EventDate;</div><div>retain CovidDate     \
&#39;01JAN2020&#39;d;</div><div>drop coviddate;</div><div>array able <span \
style="white-space:pre-wrap">	</span>colldate<span \
style="white-space:pre-wrap">	</span>InvDate<span \
style="white-space:pre-wrap">	</span>OnsetDate<span \
style="white-space:pre-wrap">	</span>ReferDate<span \
style="white-space:pre-wrap">	</span>DxDate<span \
style="white-space:pre-wrap">	</span>EventDate;</div><div>Do over able;</div><div>if \
able le coviddate then able = .;</div><div>end;</div><div>format eventdate \
mmddyy10.;</div><div>EventDate = min(CollDate,InvDate, OnsetDate, ReferDate, \
DxDate);</div><div>put eventdate \
=;</div><div><br></div><div>cards;</div><div>10821051<span \
style="white-space:pre-wrap">	</span>10/15/2020<span \
style="white-space:pre-wrap">	</span>10/21/2020<span \
style="white-space:pre-wrap">	</span>10/30/1993<span \
style="white-space:pre-wrap">	</span>.<span \
style="white-space:pre-wrap">	</span>10/15/2020<span \
style="white-space:pre-wrap">	</span>10/30/1993</div><div>run;</div><div>run;  \
</div></div><br></div><div dir="ltr"><br></div><div \
dir="ltr"><br></div><div><br></div>  
        </div><div id="gmail-m_2760587024536886618ydp2f5ba492yahoo_quoted_4602522799">
                
            <div style="font-family:&quot;Helvetica \
Neue&quot;,Helvetica,Arial,sans-serif;font-size:13px;color:rgb(38,40,42)">  
                <div>
                    On Friday, October 30, 2020, 11:54:08 AM EDT, Joe Matise &lt;<a \
href="mailto:snoopy369@gmail.com" target="_blank">snoopy369@gmail.com</a>&gt; wrote:  \
</div>  <div><br></div>
                <div><br></div>
                <div><div \
id="gmail-m_2760587024536886618ydp2f5ba492yiv3593101580"><div><div dir="ltr">There \
isn&#39;t a perfectly trivial way to do this, unfortunately, other  than just \
cleaning the individual values.   Something like this is technically possible in one \
line, but, messy.<div><br clear="none"></div><div>coviddate = \
&#39;01JAN2020&#39;d;</div><div>eventdate = min (</div><div>   ifn(colldate gt \
coviddate, collate, .),</div><div>   ifn(invdate gt coviddate, invdate, \
.),</div><div>   ifn(onsetdate gt coviddate, onsetdate, \
.),</div><div>...</div><div>);<br clear="none"></div><div><br \
clear="none"></div><div>You could do that in a macro of course:</div><div><br \
clear="none"></div><div>%macro aftercovid(var=);</div><div>   ifn(&amp;var. gt \
coviddate, &amp;var., .)</div><div>%mend aftercovid;</div><div><br \
clear="none"></div><div>eventdate = min (%aftercovid(var=colldate), \
%aftercovid(var=invdate), ... );</div><div><br \
clear="none"></div><div>-Joe</div></div><br clear="none"><div \
id="gmail-m_2760587024536886618ydp2f5ba492yiv3593101580yqt88377"><div><div \
dir="ltr">On Fri, Oct 30, 2020 at 10:00 AM Stanford Mwasongwe &lt;<a shape="rect" \
href="mailto:smwasongwe@gmail.com" rel="nofollow" \
target="_blank">smwasongwe@gmail.com</a>&gt; wrote:<br clear="none"></div><blockquote \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div \
style="font-family:verdana,sans-serif">Hi everyone</div><div \
style="font-family:verdana,sans-serif">I am creating an eventdate with the following \
line</div><div><font face="verdana, sans-serif">EventDate = min(CollDate,InvDate, \
OnsetDate, ReferDate, DxDate);</font><br clear="none"></div><div><font face="verdana, \
sans-serif">from time to time I come across things like this</font></div><div><div> \
<div align="center"> <table cellspacing="0" cellpadding="5"><thead><tr><th \
colspan="1" rowspan="1" scope="col">InvestigationID</th><th colspan="1" rowspan="1" \
scope="col">colldate</th><th colspan="1" rowspan="1" scope="col">InvDate</th><th \
colspan="1" rowspan="1" scope="col">OnsetDate</th><th colspan="1" rowspan="1" \
scope="col">ReferDate</th><th colspan="1" rowspan="1" scope="col">DxDate</th><th \
colspan="1" rowspan="1" scope="col">EventDate</th></tr></thead><tbody><tr><td \
colspan="1" rowspan="1">10821051</td><td colspan="1" rowspan="1">10/15/2020</td><td \
colspan="1" rowspan="1">10/21/2020</td><td colspan="1" rowspan="1">10/30/1993</td><td \
colspan="1" rowspan="1">.</td><td colspan="1" rowspan="1">10/15/2020</td><td \
colspan="1" rowspan="1">10/30/1993</td></tr></tbody></table></div></div>since the \
onset date is the earliest, it is selected as the eventdate, the only problem \
covid-19 was&#39;t around in that date..1993. How do I code these four hierarchy  \
dates without selecting any date that is pre covid? Thanks for the \
help</div><div><div dir="ltr"><div dir="ltr"><div><span \
style="font-size:x-small"><font size="2" style="background-color:inherit"><font><span \
style="font-size:10pt"><font face="bookman old style, new york, times, serif" \
color="#444444" style="background-color:inherit"><b>Stanford</b></font></span></font></font></span></div><div><br \
clear="none"></div></div></div></div></div></div></div> \
</blockquote></div></div></div></div></div>  </div>
        </div></div></blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic