Desktop productivity for business analysts and programmers

"Closest" match in EGuide

Reply
Trusted Advisor
Posts: 2,114

"Closest" match in EGuide

I know what I want to do, but can't figure out how to do it in the point-and-click part of EGuide.

I have hospital encounters and the all labs done (ever). I want the labs that were done closest to the admission of interest. It is, to me, a simple application of the HAVING operator in SQL, but I cant figure out how to get EGuide to do it. I don't want to create a code template because my students don't know how to write code. "t1" is the demographics+Encounter info and "t2" is the lab set.

EGuide gets me this far:
PROC SQL;
CREATE TABLE WORK.QUERY_FOR_DEMENC AS
SELECT t1.PID,
t2.EID,
t1.Ethnicity,
t1.Gender,
t1.Race,
t1.Age,
t1.EBegin,
t1.EEnd,
t2.LabDate,
t2.LabDateTime
t2.TestCodeDescription,
t2.NumericResult,
t2.'Unit of Measure'n,
t2.AbnormalFlag
FROM DEDUCE.DEMENC t1 LEFT JOIN DEDUCE.LABS t2 ON (t1.PID = t2.PID)
GROUP BY t1.PID, t2.EID, t2.TestCodeDescription ;

I want to add
HAVING t2.LabDateTime = MIN(t2.LabDateTime)
at the end.

Is that functionality there and I just can't see it, or is a "feature" for future development? Any workaround ideas?

Thanks,
Doc
Contributor
Posts: 30

Re: "Closest" match in EGuide

Hi

You can use the the bottom box, "Filter the summarized data", on the filter tab to create your having clauses
Trusted Advisor
Posts: 2,114

Re: "Closest" match in EGuide

Bingo. thanks.
Ask a Question
Discussion stats
  • 2 replies
  • 119 views
  • 0 likes
  • 2 in conversation