Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: generating dummy variables based on freq of duplicate values


From   Yerik Kaslow <[email protected]>
To   [email protected]
Subject   st: generating dummy variables based on freq of duplicate values
Date   Mon, 19 Aug 2013 20:55:27 -0500

Hello Statalist,

I apologize if this email already got sent out. I sent it w the word
help in the first line so it may have bounced, I am sorry if this is a
duplicate email. I'm not trying to spam the listserv, I'm just new at
this.

I am working w a dataset for clinical trials. My data has patient IDs which
often repeat; everytime they participate in a trial, they are recorded. I
want to group the patient IDs into high frequency and low frequency
participants, based on the frequency they are involved with the clinical
trials. I am trying to write syntax to create a dummy variable based on
frequency of duplicate patientIDs.

EG:
Patient ID 6523 appears 2 times
Patient ID 7634 appears 10 times
Patient ID 8798 appears 4 times
Patient ID 9032 appears 21 times

I would like to write syntax such that any patient ID with a frequency of
<= 4 (or any other value I choose) is assigned value of 0...low frequency
patient in this case. Likewise, any patient ID with a frequency of >=5 is
assigned a value of 1...high frequency patient.

How would I write syntax to say, assign a value of 1/0 based on the number
of the same patient IDs in the data?

Thank you,

Yerik

-- 
Yerik Kaslow
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index