Dear List: I have the following situation. Inner city women applying for job training. Each applicant can put down multiple sources of income. The software saves the data in an excel file. If an applicant has multiple sources of income then separate records are created. Thus an applicant could have Food stamps and another could have Medical assistance. For these two applicants they would have only one record, whereas, another applicant might have income from Family, Medical Assistance, and Food stamps. This applicant would have three records with the first record being Family, the second record Medical Assistance, and the third record would be Food stamps. I have already autorecoded the variable Sources of income into a numeric variable which has 17 levels. I now want to create 17 variables where an applicant would either have the source of income or not (coded 1 vs 0). I have previously posted a related question where I already had the records combined into one record, but the new data set that I have does not combine the multiple records (if it did then I could parse out each source and create a separate variable for each one). So I am not one step ahead of what I have to do. That is, I need to take the multiple records and create one record and then parse out the sources into separate variables. I am sure if I did some searching on the web I would be able to find how to do this, but if someone would like to help me out and enjoy the challenge I would very much appreciate it. thank you. The data looks like this (and you will notice that some applicants have applied multiple times and have the same source of income and hence different records and also multiple records of different sources of income. So I need to have Sources of income for the first application, Sources of income for the second application, etc. I hope I have explained this so that it is clear. Autorecodevariable 4942 Dorothy Medical Assistance 6 Jan 1 2005 4942 Dorothy Food stamps 3 Jan 1 2005 10729 Stephanie WIC 16 Feb 5 2006 10729 Stephanie WIC 16 April 1 2006 10729 Stephanie Part time job 9 Feb 5 2006 10729 Stephanie Part time job 9 April 1 2006 10729 Stephanie Living w/ family 5 Feb 5 2006 10729 Stephanie Living w/ family 5 April 1 2006 10729 Stephanie Food stamps 3 Feb 5 2006 10729 Stephanie Food stamps 3 April 1 2006 10734 Michele Food stamps 3 June 9 2005 10734 Michele Food stamps 3 Jan 4 2006 10734 Michele Food stamps 3 Mar 21 2007 Martin F. Sherman, Ph.D. Professor of Psychology Director of Masters Education in Psychology: Thesis Track Loyola University Maryland Department of Psychology 222 B Beatty Hall 4501 North Charles Street Baltimore, MD 21210 410-617-2417 |
Hi Martin,
I would say, something like: if (income=1) Medical_assistance=1. If (income=2) Foot_stamps=1 (etc) Aggregate /outfile=*/break=name / Medical_assistance=max(Medical_assistance)/ Foot_stamps=max(Foot_stamps)/ (etc) Greetz Frans Date: Fri, 1 Jul 2011 11:44:13 -0400 From: [hidden email] Subject: multiple (but varying) records of sources of income- To: [hidden email] Dear List: I have the following situation. Inner city women applying for job training. Each applicant can put down multiple sources of income. The software saves the data in an excel file. If an applicant has multiple sources of income then separate records are created. Thus an applicant could have Food stamps and another could have Medical assistance. For these two applicants they would have only one record, whereas, another applicant might have income from Family, Medical Assistance, and Food stamps. This applicant would have three records with the first record being Family, the second record Medical Assistance, and the third record would be Food stamps. I have already autorecoded the variable Sources of income into a numeric variable which has 17 levels. I now want to create 17 variables where an applicant would either have the source of income or not (coded 1 vs 0). I have previously posted a related question where I already had the records combined into one record, but the new data set that I have does not combine the multiple records (if it did then I could parse out each source and create a separate variable for each one). So I am not one step ahead of what I have to do. That is, I need to take the multiple records and create one record and then parse out the sources into separate variables. I am sure if I did some searching on the web I would be able to find how to do this, but if someone would like to help me out and enjoy the challenge I would very much appreciate it. thank you.
The data looks like this (and you will notice that some applicants have applied multiple times and have the same source of income and hence different records and also multiple records of different sources of income. So I need to have Sources of income for the first application, Sources of income for the second application, etc. I hope I have explained this so that it is clear. Autorecodevariable 4942 Dorothy Medical Assistance 6 Jan 1 2005 4942 Dorothy Food stamps 3 Jan 1 2005
10729 Stephanie WIC 16 Feb 5 2006 10729 Stephanie WIC 16 April 1 2006 10729 Stephanie Part time job 9 Feb 5 2006 10729 Stephanie Part time job 9 April 1 2006 10729 Stephanie Living w/ family 5 Feb 5 2006 10729 Stephanie Living w/ family 5 April 1 2006 10729 Stephanie Food stamps 3 Feb 5 2006 10729 Stephanie Food stamps 3 April 1 2006
10734 Michele Food stamps 3 June 9 2005 10734 Michele Food stamps 3 Jan 4 2006 10734 Michele Food stamps 3 Mar 21 2007
Martin F. Sherman, Ph.D. Professor of Psychology Director of Masters Education in Psychology: Thesis Track
Loyola University Maryland Department of Psychology 222 B Beatty Hall 4501 North Charles Street Baltimore, MD 21210
410-617-2417
|
Administrator
|
In reply to this post by msherman
Assuming varnames are ID Name StrSource NumSource AppDate.
VECTOR Income_Source(17). COMPUTE Income_Source(NumSource)=1. AGGREGATE OUTFILE * / BREAK ID Name AppDate /Income_Source1 TO Income_Source17 = MAX(Income_Source1 TO Income_Source17). VARIABLE LABELS Income_Source1 "Whatever Income Source code 1 is" Income_Source2 ......... Income_Source6 "Medical Assistance" etc...
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |