I'm not sure if this is possible to carry out in SPSS, but I thought I
would check just in case.
Basically I have a file that has health care data for patients that
includes the encounter id (unique identifier for the health care
encounter), medical record number (unique identifier for the patient),
and a list of primary & secondary diagnoses (if applicable). However,
in the file I have the diagnoses are listed below the data line that
contain the encounter id and medical record number, so there is no way
of linking these diagnoses back to the patient.
I am wondering if any syntax exists to generate missing data when data
files are set up like this?
Here is an example of the file:
Encounter ID Medical Record Number Primary/Secondary Diagnosis
2001 0001
open wound
fall
2003 0002
sprain
abrasion
fall
depression
Any feedback is greatly appreciated.
Many thanks,
Denise
Look up the LAG function in the Help files. If the encounter id
variable is numeric, you can use the MISSING function, something like
this:
do if missing(encounter_id).
- compute encounter_id = LAG(encounter_id).
- compute mrn = LAG(mrn).
end if.
But if it's a string variable, MISSING won't work, and you'll have to
do something like:
do if (encounter_id EQ "").
- compute encounter_id = LAG(encounter_id).
- compute mrn = LAG(mrn).
end if.
Should you then want to move all the data for an encounter to a single
row (which may be necessary for some analyses), look up CASESTOVARS.
--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."
This is amazing, it has completely fixed my file. I am so happy!
Many thanks for your kind help,
Best,
Denise
> bwea...@lakeheadu.cahttp://sites.google.com/a/lakeheadu.ca/bweaver/Home
Something like that is needed if the data are already in an SPSS
file with all those ID fields missing.
But it otherwise looks like an application that calls for Input
Record definitions. It would be easier for Input Record to
deal with multiple lines of followup (I think) if the lines of a case
were numbered in a unique column.
--
Rich Ulrich
And I got quite a kick out of your enthusiastic reaction, so I'd say
we're even. ;-)
--
Bruce Weaver
bwe...@lakeheadu.ca
:) I mean it! You have saved the day.
Quite right, Rich. I wondered if the data file arose from using MATCH
FILES with /FILE where /TABLE should have been used. Several years
ago, before I knew about that distinction, I often ended up with data
files like the one Denise described, and used LAG to fill in data on
rows where it was missing. Later, when I did learn about /TABLE, I
immediately thought about how much time and effort I could have saved
if I'd know that sooner! ;-)
Denise, if you did arrive at that data file format via MATCH FILES,
look at the one-to-many merging example here:
http://www.ats.ucla.edu/stat/spss/modules/merge.htm
;-)
On Feb 3, 9:47 pm, Bruce Weaver <bwea...@lakeheadu.ca> wrote:
> On Feb 3, 2:31 pm, Denise <mcfadden.den...@gmail.com> wrote:
>
> > Dear Bruce,
>
> > This is amazing, it has completely fixed my file. I am so happy!
>
> > Many thanks for your kind help,
>
> > Best,
>
> > Denise
>
> And I got quite a kick out of your enthusiastic reaction, so I'd say
> we're even. ;-)
>
> --
> Bruce Weaver
> bwea...@lakeheadu.cahttp://sites.google.com/a/lakeheadu.ca/bweaver/Home