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

List:       sas-l
Subject:    Re: Nice real word application of functions in formats
From:       Roger DeAngelis <rogerjdeangelis () GMAIL ! COM>
Date:       2015-09-27 21:54:01
Message-ID: CAOUdXL8znJq7duFrSPNyvyBwnco20hzLsMTeScWV3NNQWvS+MQ () mail ! gmail ! com
[Download RAW message or body]

Hi Team

Iam not a clinician but:

It may just be a buketing and naming issue, it is not easy to place so may
codes into do few groups.

Note Ihave retired 3015 because I bracket 3025-3099, 3015 is not in our
data.


3rd digit = 0 IPPS Acute Inpatient Prospective Payment Hospitals

3rd & 4th digits = 13 CAH

Last 4 digits = LTC Lesser Long Term care

3025 through 3099

or 3rd digit = R or T

3rd & 4th digits = IRF Inpatient Rehab Hospitals

20, 21, 22
​

On Thu, Sep 24, 2015 at 12:59 PM, Kirby, Ted <ted.kirby@lewin.com> wrote:

> I think that Roger's original information is flawed.  The following is
> incorrect:
>
> XX3015 is a Long Term Care Institution  LTC
> XX20XX is a Acute Care Hospital            CAH
>
> According to the Research Data Assistance Center (ResDAC), the Centers for
> Medicare & Medicaid Services (CMS) contractor that assists people in
> requesting and using CMS data in analyses:
>
> xx0001-xx0879 are Acute Care Hospitals (ACH)
> xx1300-xx1399  are Critical Access Hospitals (CAHs), which are hospitals
> in rural areas
> xx3015 is in a range that has been retired, (xx3000-xx3024) that used to
> indicate tuberculosis hospitals
> xx2000-xx2299 are Long-term Care Hospitals
>
> The complete list of codes is contained at
> http://www.resdac.org/sites/resdac.org/files/Provider%20Number%20Table.txt
> .
>
> BTW the first two digits of the OSCAR number indicate the State (using the
> Social Security Administration state numbers).
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Søren Lassen
> Sent: Thursday, September 24, 2015 4:21 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Nice real word application of functions in formats
>
> Roger,
> Yes, absolutely; it is better to put the code in a single place. In terms
> of datastep code, use %include rather than cut and paste.
>
> I think the question here is: why not just use
>   facility=Osc2Fcl(code);
> rather than
>   facility=put(code,$Osc2Fcl.);
>
> The format in this case just adds another layer of complexity: when
> debugging the program you first have to find out what the format does, and
> then go on to look up the function. It would be easier to understand what
> the code is doing if you just called the function.
>
> Still, you can get some great advantages from a format, especially to
> classify by facility in a procedure simply by assigning a format to the
> code variable. Very nice!
>
> BTW, an informat may be nice to have as well. Then you can do e.g.:
> Data facilities;
>   infile oscarfile;
>   input facility $Osc2Fcl8.;
> run;
>
> Regards,
> Søren
>
>
> On Wed, 23 Sep 2015 19:07:25 -0400, Roger DeAngelis <
> rogerjdeangelis@GMAIL.COM> wrote:
>
> >Hi Team
> >
> > I think the code is a more secure and stable in a format then pasting
> >the code in a datastep.
> >
> >
> > If you hook into you function library at the same time you do your
> >'option fmtsea​rch' it is one stop shopping, because it looks just like a
> format.
> > This makes documentation easier epecially since formats can carry a
> >meta data description. It also seems very natural to make it a format.
> >
> >
> >
> >On Wed, Sep 23, 2015 at 6:15 PM, Yinglin (Max) Wu <yinglinwu@gmail.com>
> >wrote:
> >
> >> Alternatively, I guess we can put that select block into a data step
> >> to create an output data set which can be used by the cntlin= option
> >> of proc format.
> >>
> >> Max
> >>
> >> -----Original Message-----
> >> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> >> Roger DeAngelis
> >> Sent: Wednesday, September 23, 2015 4:57 PM
> >> To: SAS-L@LISTSERV.UGA.EDU
> >> Subject: Nice real word application of functions in formats
> >>
> >> One line lookup for Medical Facility using just the OSCAR id
> >>
> >> * Use the OSCAR id to find the Facility Type
> >>
> >> data _null_;
> >>   Facility=put('123050',$Osc2Fcl.);
> >>   put facility=;
> >> run;quit;
> >>
> >> Here is the output Long Care Facility.
> >> FACILITY=LTC
> >>
> >> OSCAR is a smart key in the clinical world
> >>
> >>   for instance
> >>
> >>        XX3015 is a Long Term Care Institution  LTC
> >>        XX20XX is a Acute Care Hospital            CAH
> >>
> >> Here is one algorithm (I do not do allthe possible meaningful
> >> combinations)
> >>
> >>  select;
> >>      when ( substr(oscar,3,1) = '0'                         )
> >> Facility='IPPS';
> >>      when ( substr(oscar,3,2) = '13'                        )
> >> Facility='CAH ';
> >>      when ( substr(oscar,3,2) in ('20','21','22'           ))
> >> Facility='IRF ';
> >>      when ( substr(oscar,3,2) in ('40','41','42','43','44'  )
> >>             or substr(oscar,3,1) in ('M','S')               )
> >> Facility='IPF ';
> >>      when ( 3025<=input(substr(oscar,3,4),/* ?? */ 4.)<=3099
> >>             or substr(oscar,3,1) in ('R','T')               )
> >> Facility='LTC ';
> >>      otherwise
> >> Facility='OTH ';
> >>  end;
> >>
> >> Lets put the algorithm into a format (via Rick Langston paper)
> >>
> >> proc fcmp outlib=work.functions.Institutions;
> >>   function Osc2Fcl(oscar $) $10;
> >>    select;
> >>      when ( substr(oscar,3,1) = '0'                         )
> >> Facility='IPPS';
> >>      when ( substr(oscar,3,2) = '13'                        )
> >> Facility='CAH ';
> >>      when ( substr(oscar,3,2) in ('20','21','22'           ))
> >> Facility='IRF ';
> >>      when ( substr(oscar,3,2) in ('40','41','42','43','44'  )
> >>             or substr(oscar,3,1) in ('M','S')               )
> >> Facility='IPF ';
> >>      when ( 3025<=input(substr(oscar,3,4),/* ?? */ 4.)<=3099
> >>             or substr(oscar,3,1) in ('R','T')               )
> >> Facility='LTC ';
> >>      otherwise
> >> Facility='OTH ';
> >>    end;
> >>   return(Facility);
> >> endsub;
> >> run;quit;
> >>
> >> options cmplib=(work.functions);
> >> proc format;
> >> value $Osc2Fcl (default=6) other=[Osc2Fcl()]; run;quit;
> >>
> >> data _null_;
> >>   Facility=put('123050',$Osc2Fcl.);
> >>   put facility=;
> >> run;quit;
> >>
> >> FACILITY=LTC
> >>
> >>
> >
>
> --
> ************* IMPORTANT - PLEASE READ ********************
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information,
> and may be used only by the person or entity to which it is addressed. If
> the reader of this
> e-mail is not the intended recipient or his or her authorized agent, the
> reader is hereby
> notified that any dissemination, distribution or copying of this e-mail is
> prohibited. If you
> have received this e-mail in error, please notify the sender by replying to
> this message
> and delete this e-mail immediately.
>

[Attachment #3 (text/html)]

<div dir="ltr"><div style="font-family:courier new,monospace;font-size:small" \
class="gmail_default">Hi Team</div><div style="font-family:courier \
new,monospace;font-size:small" class="gmail_default">  </div><div \
style="font-family:courier new,monospace;font-size:small" class="gmail_default">Iam \
not a clinician but:</div><div style="font-family:courier \
new,monospace;font-size:small" class="gmail_default">  </div><div \
style="font-family:courier new,monospace;font-size:small" class="gmail_default">It \
may just be a buketing and naming issue, it is not easy to place so may codes into do \
few groups.</div><div style="font-family:courier new,monospace;font-size:small" \
class="gmail_default">  </div><div style="font-family:courier \
new,monospace;font-size:small" class="gmail_default">Note Ihave retired 3015 because \
I bracket 3025-3099, 3015 is not in our data.</div><div style="font-family:courier \
new,monospace;font-size:small" class="gmail_default">  </div><div \
style="font-family:courier new,monospace;font-size:small" class="gmail_default"><font \
size="1"> </font><p>3rd digit = 0              IPPS  Acute Inpatient Prospective \
Payment Hospitals</p>

<p>3rd &amp; 4th digits = 13      CAH</p>

<p>Last 4 digits =            LTC   Lesser Long Term care</p>
<p>3025 through 3099</p>
<p>or 3rd digit = R or T</p>

<p>3rd &amp; 4th digits =         IRF   Inpatient Rehab Hospitals</p>
<p>20, 21, 22</p>​</div></div><div class="gmail_extra"><br><div \
class="gmail_quote">On Thu, Sep 24, 2015 at 12:59 PM, Kirby, Ted <span \
dir="ltr">&lt;<a href="mailto:ted.kirby@lewin.com" \
target="_blank">ted.kirby@lewin.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">I think that Roger&#39;s original information is flawed.   \
The following is incorrect:<br> <span><br>
XX3015 is a Long Term Care Institution   LTC<br>
XX20XX is a Acute Care Hospital                  CAH<br>
<br>
</span>According to the Research Data Assistance Center (ResDAC), the Centers for \
Medicare &amp; Medicaid Services (CMS) contractor that assists people in requesting \
and using CMS data in analyses:<br> <br>
xx0001-xx0879 are Acute Care Hospitals (ACH)<br>
xx1300-xx1399   are Critical Access Hospitals (CAHs), which are hospitals in rural \
areas<br> xx3015 is in a range that has been retired, (xx3000-xx3024) that used to \
indicate tuberculosis hospitals<br> xx2000-xx2299 are Long-term Care Hospitals<br>
<br>
The complete list of codes is contained at <a \
href="http://www.resdac.org/sites/resdac.org/files/Provider%20Number%20Table.txt" \
rel="noreferrer" target="_blank">http://www.resdac.org/sites/resdac.org/files/Provider%20Number%20Table.txt</a>.<br>
 <br>
BTW the first two digits of the OSCAR number indicate the State (using the Social \
Security Administration state numbers).<br> <div><div class="h5"><br>
<br>
<br>
-----Original Message-----<br>
From: SAS(r) Discussion [mailto:<a \
href="mailto:SAS-L@LISTSERV.UGA.EDU">SAS-L@LISTSERV.UGA.EDU</a>] On Behalf Of Søren \
                Lassen<br>
Sent: Thursday, September 24, 2015 4:21 AM<br>
To: <a href="mailto:SAS-L@LISTSERV.UGA.EDU">SAS-L@LISTSERV.UGA.EDU</a><br>
Subject: Re: Nice real word application of functions in formats<br>
<br>
Roger,<br>
Yes, absolutely; it is better to put the code in a single place. In terms of datastep \
code, use %include rather than cut and paste.<br> <br>
I think the question here is: why not just use<br>
   facility=Osc2Fcl(code);<br>
rather than<br>
   facility=put(code,$Osc2Fcl.);<br>
<br>
The format in this case just adds another layer of complexity: when debugging the \
program you first have to find out what the format does, and then go on to look up \
the function. It would be easier to understand what the code is doing if you just \
called the function.<br> <br>
Still, you can get some great advantages from a format, especially to classify by \
facility in a procedure simply by assigning a format to the code variable. Very \
nice!<br> <br>
BTW, an informat may be nice to have as well. Then you can do e.g.:<br>
Data facilities;<br>
   infile oscarfile;<br>
   input facility $Osc2Fcl8.;<br>
run;<br>
<br>
Regards,<br>
Søren<br>
<br>
<br>
On Wed, 23 Sep 2015 19:07:25 -0400, Roger DeAngelis &lt;<a \
href="mailto:rogerjdeangelis@GMAIL.COM">rogerjdeangelis@GMAIL.COM</a>&gt; wrote:<br> \
<br> &gt;Hi Team<br>
&gt;<br>
&gt; I think the code is a more secure and stable in a format then pasting<br>
&gt;the code in a datastep.<br>
&gt;<br>
&gt;<br>
&gt; If you hook into you function library at the same time you do your<br>
&gt;&#39;option fmtsea​rch&#39; it is one stop shopping, because it looks just like \
a format.<br> &gt; This makes documentation easier epecially since formats can carry \
a<br> &gt;meta data description. It also seems very natural to make it a format.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;On Wed, Sep 23, 2015 at 6:15 PM, Yinglin (Max) Wu &lt;<a \
href="mailto:yinglinwu@gmail.com">yinglinwu@gmail.com</a>&gt;<br> &gt;wrote:<br>
&gt;<br>
&gt;&gt; Alternatively, I guess we can put that select block into a data step<br>
&gt;&gt; to create an output data set which can be used by the cntlin= option<br>
&gt;&gt; of proc format.<br>
&gt;&gt;<br>
&gt;&gt; Max<br>
&gt;&gt;<br>
&gt;&gt; -----Original Message-----<br>
&gt;&gt; From: SAS(r) Discussion [mailto:<a \
href="mailto:SAS-L@LISTSERV.UGA.EDU">SAS-L@LISTSERV.UGA.EDU</a>] On Behalf Of<br> \
&gt;&gt; Roger DeAngelis<br> &gt;&gt; Sent: Wednesday, September 23, 2015 4:57 PM<br>
&gt;&gt; To: <a href="mailto:SAS-L@LISTSERV.UGA.EDU">SAS-L@LISTSERV.UGA.EDU</a><br>
&gt;&gt; Subject: Nice real word application of functions in formats<br>
&gt;&gt;<br>
&gt;&gt; One line lookup for Medical Facility using just the OSCAR id<br>
&gt;&gt;<br>
&gt;&gt; * Use the OSCAR id to find the Facility Type<br>
&gt;&gt;<br>
&gt;&gt; data _null_;<br>
&gt;&gt;     Facility=put(&#39;123050&#39;,$Osc2Fcl.);<br>
&gt;&gt;     put facility=;<br>
&gt;&gt; run;quit;<br>
&gt;&gt;<br>
&gt;&gt; Here is the output Long Care Facility.<br>
&gt;&gt; FACILITY=LTC<br>
&gt;&gt;<br>
&gt;&gt; OSCAR is a smart key in the clinical world<br>
&gt;&gt;<br>
&gt;&gt;     for instance<br>
&gt;&gt;<br>
&gt;&gt;            XX3015 is a Long Term Care Institution   LTC<br>
&gt;&gt;            XX20XX is a Acute Care Hospital                  CAH<br>
&gt;&gt;<br>
&gt;&gt; Here is one algorithm (I do not do allthe possible meaningful<br>
&gt;&gt; combinations)<br>
&gt;&gt;<br>
&gt;&gt;   select;<br>
&gt;&gt;         when ( substr(oscar,3,1) = &#39;0&#39;                               \
)<br> &gt;&gt; Facility=&#39;IPPS&#39;;<br>
&gt;&gt;         when ( substr(oscar,3,2) = &#39;13&#39;                              \
)<br> &gt;&gt; Facility=&#39;CAH &#39;;<br>
&gt;&gt;         when ( substr(oscar,3,2) in (&#39;20&#39;,&#39;21&#39;,&#39;22&#39;  \
))<br> &gt;&gt; Facility=&#39;IRF &#39;;<br>
&gt;&gt;         when ( substr(oscar,3,2) in \
(&#39;40&#39;,&#39;41&#39;,&#39;42&#39;,&#39;43&#39;,&#39;44&#39;   )<br> &gt;&gt;    \
or substr(oscar,3,1) in (&#39;M&#39;,&#39;S&#39;)                       )<br> \
&gt;&gt; Facility=&#39;IPF &#39;;<br> &gt;&gt;         when ( \
3025&lt;=input(substr(oscar,3,4),/* ?? */ 4.)&lt;=3099<br> &gt;&gt;                   \
or substr(oscar,3,1) in (&#39;R&#39;,&#39;T&#39;)                       )<br> \
&gt;&gt; Facility=&#39;LTC &#39;;<br> &gt;&gt;         otherwise<br>
&gt;&gt; Facility=&#39;OTH &#39;;<br>
&gt;&gt;   end;<br>
&gt;&gt;<br>
&gt;&gt; Lets put the algorithm into a format (via Rick Langston paper)<br>
&gt;&gt;<br>
&gt;&gt; proc fcmp outlib=work.functions.Institutions;<br>
&gt;&gt;     function Osc2Fcl(oscar $) $10;<br>
&gt;&gt;      select;<br>
&gt;&gt;         when ( substr(oscar,3,1) = &#39;0&#39;                               \
)<br> &gt;&gt; Facility=&#39;IPPS&#39;;<br>
&gt;&gt;         when ( substr(oscar,3,2) = &#39;13&#39;                              \
)<br> &gt;&gt; Facility=&#39;CAH &#39;;<br>
&gt;&gt;         when ( substr(oscar,3,2) in (&#39;20&#39;,&#39;21&#39;,&#39;22&#39;  \
))<br> &gt;&gt; Facility=&#39;IRF &#39;;<br>
&gt;&gt;         when ( substr(oscar,3,2) in \
(&#39;40&#39;,&#39;41&#39;,&#39;42&#39;,&#39;43&#39;,&#39;44&#39;   )<br> &gt;&gt;    \
or substr(oscar,3,1) in (&#39;M&#39;,&#39;S&#39;)                       )<br> \
&gt;&gt; Facility=&#39;IPF &#39;;<br> &gt;&gt;         when ( \
3025&lt;=input(substr(oscar,3,4),/* ?? */ 4.)&lt;=3099<br> &gt;&gt;                   \
or substr(oscar,3,1) in (&#39;R&#39;,&#39;T&#39;)                       )<br> \
&gt;&gt; Facility=&#39;LTC &#39;;<br> &gt;&gt;         otherwise<br>
&gt;&gt; Facility=&#39;OTH &#39;;<br>
&gt;&gt;      end;<br>
&gt;&gt;     return(Facility);<br>
&gt;&gt; endsub;<br>
&gt;&gt; run;quit;<br>
&gt;&gt;<br>
&gt;&gt; options cmplib=(work.functions);<br>
&gt;&gt; proc format;<br>
&gt;&gt; value $Osc2Fcl (default=6) other=[Osc2Fcl()]; run;quit;<br>
&gt;&gt;<br>
&gt;&gt; data _null_;<br>
&gt;&gt;     Facility=put(&#39;123050&#39;,$Osc2Fcl.);<br>
&gt;&gt;     put facility=;<br>
&gt;&gt; run;quit;<br>
&gt;&gt;<br>
&gt;&gt; FACILITY=LTC<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
<br>
</div></div>--<br>
************* IMPORTANT - PLEASE READ ********************<br>
<br>
This e-mail, including attachments, may include confidential and/or<br>
proprietary information,<br>
and may be used only by the person or entity to which it is addressed. If<br>
the reader of this<br>
e-mail is not the intended recipient or his or her authorized agent, the<br>
reader is hereby<br>
notified that any dissemination, distribution or copying of this e-mail is<br>
prohibited. If you<br>
have received this e-mail in error, please notify the sender by replying to<br>
this message<br>
and delete this e-mail immediately.<br>
</blockquote></div><br></div>



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

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