MS Access Forum / Queries / May 2008
re-coding values
|
|
Thread rating:  |
Bluesky - 12 May 2008 19:41 GMT I know this is simple to do, but can’t seem to do it correctly!!
I have a “final_status” variable field that contains values such as “active” “complete” “patient refused” and “doctor refused.”
I want to re-code or re-group these into 4 new variables.
“Eligible” would contain all the values above: “active” “complete” “patient refused” and “doctor refused”.
“Active” would not change, but would include only the “active” values (do I need to re-code it, though?)
“Complete” would not change, but would include only the “complete” values
“Refused” would include “doctor refused” and “patient refused.”
I thought I could use the IIF expression but am having trouble getting it correctly
Thanks in advance.
John Spencer - 12 May 2008 20:03 GMT Perhaps what you want is something like the following:
Field: Eligible: IIF([Status] in ("Active","Complete","Patient Refused","Doctor Refused","Eligible",Null)
Field: Active: IIF([Status] = "Active","Active",Null)
Field: Active: IIF([Status] = "Complete","Complete",Null)
Field: Refused: IIF([Status] in ("Patient Refused","Doctor Refused","Refused",Null)
John Spencer Access MVP 2002-2005, 2007-2008 Center for Health Program Development and Management University of Maryland Baltimore County
> I know this is simple to do, but can’t seem to do it correctly!! > [quoted text clipped - 17 lines] > > Thanks in advance. Bluesky - 12 May 2008 21:33 GMT Hi John,
I tried this:
Eligible: IIf([final_status] in ("Complete","Active","Provider refuses","Pat/Fam refuses","Second interview refused","Eligible",Null))
and get an error: "the expression you entered has a function containing the wrong number of arguments."
I can't figure out what is wrong.
Thanks again,
BlueSky
> Perhaps what you want is something like the following: > [quoted text clipped - 34 lines] > > > > Thanks in advance. John Spencer - 12 May 2008 22:35 GMT Parentheses in the wrong places
Eligible: IIf([final_status] in ("Complete","Active","Provider refuses","Pat/Fam refuses","Second interview refused"),"Eligible",Null)
I see I left out the closing parens in the In expression. Sorry about that.
'==================================================== John Spencer Access MVP 2002-2005, 2007-2008 Center for Health Program Development and Management University of Maryland Baltimore County '====================================================
> Hi John, > [quoted text clipped - 51 lines] >>> >>> Thanks in advance. Bluesky - 13 May 2008 16:53 GMT Hi John,
Thanks for your help!
Is there a way to string these all together to get a new variable called "NewFinalStatus" that will have four values: eligible, complete, active and refused, and to get a total count of each. I thought I could figure it out, am having trouble..
Thanks,
Debbie
> Parentheses in the wrong places > [quoted text clipped - 66 lines] > >>> > >>> Thanks in advance. John Spencer - 13 May 2008 19:03 GMT Well, I don't understand what you want.
IF someone has a Final_Status of "Active" is NewFinalStatus "Eligible" or is it "Active"? What if Final_Status is "Patient Refused" or "Doctor Refused" what is the final Status "Eligible" or "Refused"?
You can set up an expression to give you one of the four categories, but the rules need to be clear.
John Spencer Access MVP 2002-2005, 2007-2008 Center for Health Program Development and Management University of Maryland Baltimore County
> Hi John, > [quoted text clipped - 79 lines] >>>>> >>>>> Thanks in advance. Bluesky - 13 May 2008 19:25 GMT Hi John,
I might be going at this incorrectly. I basically need to know how many subjects are eligible and of those eligible how many completed the study, refused, or are still active, to know my response rate.
I already have a "final_status" field which contains multiple values. bit I'm only interested in these five who are considered "eligible" - complete, active, provider refuses, pat/fam refuses, second interview refused.
So, first I want to get a count of all those that are "eligible" (those five listed above).
then I want to know how many of those that are "eligible" are "completed "(which I already have as a value in "final_status"), and "active", (which I already have as a value in "final_status"), and then I want to know how many of those that are "eligible" fall under "refused" which would be combining the "final_status" values of "provider refuses", Pat/fam refuses" and +second interview refused."
So, this is what I came up with, which of course doesn't work. Thanks for all your help. I really do appreciate it. - BlueSky
New_Final_Status: IIf([final_status] In ("Complete","Active","Provider refuses","Pat/Fam refuses","Second interview refused"),"Eligible",Null)IIf([final_status]="Complete","Complete",Null), IIf([final_status]="Active","Active",Null),IIf([final_status] in ("Provider refuses","Pat/fam refuses","Second interview refused"),"Refused",Null))
> Well, I don't understand what you want. > [quoted text clipped - 94 lines] > >>>>> > >>>>> Thanks in advance.
|
|
|