[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 fmtsearch' 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 & 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 & 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"><<a href="mailto:ted.kirby@lewin.com" \
target="_blank">ted.kirby@lewin.com</a>></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'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 & 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 <<a \
href="mailto:rogerjdeangelis@GMAIL.COM">rogerjdeangelis@GMAIL.COM</a>> wrote:<br> \
<br> >Hi Team<br>
><br>
> I think the code is a more secure and stable in a format then pasting<br>
>the code in a datastep.<br>
><br>
><br>
> If you hook into you function library at the same time you do your<br>
>'option fmtsearch' it is one stop shopping, because it looks just like \
a format.<br> > This makes documentation easier epecially since formats can carry \
a<br> >meta data description. It also seems very natural to make it a format.<br>
><br>
><br>
><br>
>On Wed, Sep 23, 2015 at 6:15 PM, Yinglin (Max) Wu <<a \
href="mailto:yinglinwu@gmail.com">yinglinwu@gmail.com</a>><br> >wrote:<br>
><br>
>> Alternatively, I guess we can put that select block into a data step<br>
>> to create an output data set which can be used by the cntlin= option<br>
>> of proc format.<br>
>><br>
>> Max<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<br> \
>> Roger DeAngelis<br> >> Sent: Wednesday, September 23, 2015 4:57 PM<br>
>> To: <a href="mailto:SAS-L@LISTSERV.UGA.EDU">SAS-L@LISTSERV.UGA.EDU</a><br>
>> Subject: Nice real word application of functions in formats<br>
>><br>
>> One line lookup for Medical Facility using just the OSCAR id<br>
>><br>
>> * Use the OSCAR id to find the Facility Type<br>
>><br>
>> data _null_;<br>
>> Facility=put('123050',$Osc2Fcl.);<br>
>> put facility=;<br>
>> run;quit;<br>
>><br>
>> Here is the output Long Care Facility.<br>
>> FACILITY=LTC<br>
>><br>
>> OSCAR is a smart key in the clinical world<br>
>><br>
>> for instance<br>
>><br>
>> XX3015 is a Long Term Care Institution LTC<br>
>> XX20XX is a Acute Care Hospital CAH<br>
>><br>
>> Here is one algorithm (I do not do allthe possible meaningful<br>
>> combinations)<br>
>><br>
>> select;<br>
>> when ( substr(oscar,3,1) = '0' \
)<br> >> Facility='IPPS';<br>
>> when ( substr(oscar,3,2) = '13' \
)<br> >> Facility='CAH ';<br>
>> when ( substr(oscar,3,2) in ('20','21','22' \
))<br> >> Facility='IRF ';<br>
>> when ( substr(oscar,3,2) in \
('40','41','42','43','44' )<br> >> \
or substr(oscar,3,1) in ('M','S') )<br> \
>> Facility='IPF ';<br> >> when ( \
3025<=input(substr(oscar,3,4),/* ?? */ 4.)<=3099<br> >> \
or substr(oscar,3,1) in ('R','T') )<br> \
>> Facility='LTC ';<br> >> otherwise<br>
>> Facility='OTH ';<br>
>> end;<br>
>><br>
>> Lets put the algorithm into a format (via Rick Langston paper)<br>
>><br>
>> proc fcmp outlib=work.functions.Institutions;<br>
>> function Osc2Fcl(oscar $) $10;<br>
>> select;<br>
>> when ( substr(oscar,3,1) = '0' \
)<br> >> Facility='IPPS';<br>
>> when ( substr(oscar,3,2) = '13' \
)<br> >> Facility='CAH ';<br>
>> when ( substr(oscar,3,2) in ('20','21','22' \
))<br> >> Facility='IRF ';<br>
>> when ( substr(oscar,3,2) in \
('40','41','42','43','44' )<br> >> \
or substr(oscar,3,1) in ('M','S') )<br> \
>> Facility='IPF ';<br> >> when ( \
3025<=input(substr(oscar,3,4),/* ?? */ 4.)<=3099<br> >> \
or substr(oscar,3,1) in ('R','T') )<br> \
>> Facility='LTC ';<br> >> otherwise<br>
>> Facility='OTH ';<br>
>> end;<br>
>> return(Facility);<br>
>> endsub;<br>
>> run;quit;<br>
>><br>
>> options cmplib=(work.functions);<br>
>> proc format;<br>
>> value $Osc2Fcl (default=6) other=[Osc2Fcl()]; run;quit;<br>
>><br>
>> data _null_;<br>
>> Facility=put('123050',$Osc2Fcl.);<br>
>> put facility=;<br>
>> run;quit;<br>
>><br>
>> FACILITY=LTC<br>
>><br>
>><br>
><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