recode to groups, a challenge!

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

marthak
Posts: 2
Joined: Fri Dec 13, 2013 9:49 pm

recode to groups, a challenge!

Postby marthak » Fri Dec 13, 2013 10:06 pm

This may only be a challenge for me, as it's been awhile. I am comfortable with regular recoding, but here's the challenge I'm facing.

- I have a data set of ~10,000 order entries for a medication, with individual medical record numbers as unique identifier, date of order, and where it was ordered. Each order is entered as an individual case. Therefore, for MR 123456 who had 17 orders for the medication, there are 17 individual entries.
- I would like to know the following: by MR number (individual patient), how often was the medication ordered, and were the orders in sequential dates?

My challenge has been in trying to create a variable called "frequency" and then have the system read the MR# and assign a unique identifier to each MR (so there would be 2000 "individuals" with a total frequency of the 10000 orders). the challenge is that in usual recoding your giving a value (say 1-4 out of 100) and creating a new value of 1, and this doesn't work that way. If I have the "frequency" dummy variable than I can sort and analyze as I need to start mining the data.

I am working with SPSS 21, Windows based, and with data pulled for a QI project from a large academic medical center.

All help appreciated.
Last edited by marthak on Sun Dec 15, 2013 3:01 pm, edited 1 time in total.
statman
Administrator
Posts: 2699
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

Re: recode to groups, a challenge!

Postby statman » Sun Dec 15, 2013 1:20 pm

See the Note below
See the note below

NOTE: Please read the Posting Guidelines and always tell us your OS, the SPSS version and information about your study and data!

Statman
Statistical Services
marthak
Posts: 2
Joined: Fri Dec 13, 2013 9:49 pm

Re: recode to groups, a challenge!

Postby marthak » Sun Dec 15, 2013 3:01 pm

Corrected in post above.
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: recode to groups, a challenge!

Postby GerineL » Tue Dec 17, 2013 12:45 pm

Not entirely sure if this will help, but look into:

- aggregate (count cases ("weighed N") for each ID
- this syntax can help you form a sequence:


compute sequence=1.
if ( (ID = lag(ID)) sequence= (lag(sequence) +1).
execute.

Who is online

Users browsing this forum: No registered users and 1 guest

cron