Hi
I am facing a problem with computing a new variable using SPSS. I have 2 variables: One that shows respondents qualifications and another one which shows the type of the highest of those qualifications. Let's name the former as ''A'' and the latter as ''B''. ''A'' variable includes values up to a certain level of qualifications and the highest of those values is value ''1'' which corresponds to holders of a Higher postgraduate degree. Variable ''B'' now only includes responders who have a higher postgraduate degree classifying them into 5 different categories (Post Doc, PhD, MA, Msc, PGcert). I mention here that cases of value ''1'' of variable A and cases of all values of variable ''B'' are exactly the same number (precisely 4837). What I want to do is to combine these two variables and create another one which will include all cases of variable ''A'' replacing variable's ''A'' value 1 with all the values found in variable ''B'',. So the new variable will have exactly the same cases as variable ''A'' but more values by the replacement of value 1 with all values of variable 'B''. But the problem is that I don't know how...Please HELP!!! |
Administrator
|
Please provide a few lines of sample data that show exactly what A and B look like originally, and what you want the modified A variable to look like. And clarify whether the variables are numeric or string.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Hi again and many thanks for your reply. First of all as you can see below both variables are numeric. Below you can find the two frequencies as shown in my SPSS output. Numbers are original and not random. All I want is to replace ''Higher Education'' value of variable ''A'' with all values found in variable ''B''. In other words I want to create a new variable with all cases found in ''A'' also placing the values of variable ''B'' where variable's ''A'' ''Higher Degree'' value is right now.
Variable A: Frequency Percent Valid Percent Cumulative Percent Higher Degree 4836 4.2 6.5 6.5 NVQ level 5 137 .1 .2 6.6 First/Foundation degree 9233 8.1 12.3 19.0 ..... Other qualif 5734 5.0 7.7 85.7 No qualif 10031 8.8 13.4 99.1 Don't know 681 .6 .9 100.0 Total 74846 65.4 100.0 Does not apply 35894 31.4 No answer 3752 3.3 System missing 39648 34.6 Total 114493 Variable B: Frequency Percent Valid Percent Cumulative Percent Valid Doctorate 662 .6 13.7 13.7 Masters 2562 2.2 53.0 66.7 Post grad cert in educ 968 .8 20.0 86.7 Other post grad degree or prof qual 603 .5 12.5 99.2 Don't know 41 .0 .8 100.0 Total 4836 4.2 100.0 Hope this makes it more comprehensive, Theo |
Freq_of_variables.docx
Sorry for that messy output. Here you can find attached a file with both frequencies attached as tables. |
Administrator
|
In reply to this post by Theoharisk
Why not something like...
COMPUTE AB=A. IF AB=1 AB=B. VALUE LABELS AB ...... fill in the value labels.
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?" |
Thanks so much but can you please also tell me how can I execute it in a non-syntax SPSS mode? I mean by using SPSS windows. Ok I open the compute function and put AB variable in the target variable box. Can you please help me on explaining what should I right in the numeric expression box and the ''if'' condition should be satisfied? Sorry for that but I am a new user and I am not at all familiar with SPSS syntax.
Thanks again, Theo |
Administrator
|
Sorry, I don't do "windoze"!
---
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?" |
Ok I see.
If my data file is named as ''dataset1'' and my new variable as QUAL can you please write a syntax code for this: ''COMPUTE AB=A. IF AB=1 AB=B.'' I have really stucked to that and I have a deadline to meet for tomorrow so I would appreciate it amain. I can't find any other solution to the web and you are my last hope for that!PLZ!!!! Theo |
Administrator
|
In reply to this post by David Marso
Setting AB = B is going to cause problems, I think, because the values 1-5 are used by both variables. Better to do something like this: do if A=1. /* higher degree . - compute AB = B. /* which higher degree (1-5). else. - compute AB = A+4. /* (2 -> 6, 3 -> 7, etc). end if. VALUE LABELS AB ...... fill in the value labels. This will result in the following values for variable AB: 1 "Doctorate" 2 "Masters" 3 "Post grad cert in educ" 4 "Other post grad degree or prof qual" 5 "Don't know" 6 "NVQ level 5" 7 "First/Foundation degree" 8 "Other degree" etc The 5 "Don't know" case doesn't make much sense to me, but that is one of the values currently listed for variable B, which lists types of higher degrees. I should have thought it would be lumped in with 4 "Other post grad degree or qual". HTH.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by Bruce Weaver
It'll take forever using the GUI. I made a dummy data set. 1 1 1 2 1 3 1 1 1 2 1 3 1 4 1 5 2 0 4 0 3 0 6 0 6 8 0 9 7 0 Go to your data and open a new syntax window with: File > new > syntax Then write: recode a (1 = 10) . compute c = a + b. format c (f2.0) . freq c . This yields c with values 11 - 15 and 2 thru whatever. You can then recode the values of c and change your value labels to match.
Recode c (11=1)(12=2)(13=3)(14=4)(15=5) (2=6)(3=7) etc etc This saves messing about in the GUI. You can see a tutorial on syntax for data transformations on page http://surveyresearch.weebly.com/block-2-analysing-one-variable.html on my website. John F Hall www.surveyresearch.weebly.com -----Original Message----- Please provide a few lines of sample data that show exactly what A and B look like originally, and what you want the modified A variable to look like. And clarify whether the variables are numeric or string. Theoharisk wrote: > > Hi > > I am facing a problem with computing a new variable using SPSS. I have 2 > variables: One that shows respondents qualifications and another one which > shows the type of the highest of those qualifications. Let's name the > former > as ''A'' and the latter as ''B''. ''A'' variable includes values up to a > certain level of qualifications and the highest of those values is value > ''1'' which corresponds to holders of a Higher postgraduate degree. > Variable > ''B'' now only includes responders who have a higher postgraduate degree > classifying them into 5 different categories (Post Doc, PhD, MA, Msc, > PGcert). > I mention here that cases of value ''1'' of variable A and cases of all > values of variable ''B'' are exactly the same number (precisely 4837). > What I > want to do is to combine these two variables and create another one which > will include all cases of variable ''A'' replacing variable's ''A'' value > 1 > with all the values found in variable ''B'',. So the new variable will > have > exactly the same cases as variable ''A'' but more values by the > replacement > of value 1 with all values of variable 'B''. But the problem is that I > don't > know how...Please HELP!!! > ----- -- Bruce Weaver http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Adding-values-to-existing-variable-HELP-tp4406213p4406236.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by Bruce Weaver
Don’t know where the first three data lines below came from, as my result only showed 1 case each of values 11, 12 and 13. Also cases missing on B should still be counted in C, so syntax needs editing to take account of that. Bruce’s solution is neater, but the outcome is the same. From: John F Hall [mailto:[hidden email]] It'll take forever using the GUI. I made a dummy data set. 1 1 1 2 1 3 1 1 1 2 1 3 1 4 1 5 2 0 4 0 3 0 6 0 6 8 0 9 7 0 Go to your data and open a new syntax window with: File > new > syntax Then write: recode a (1 = 10) . compute c = a + b. format c (f2.0) . freq c . This yields c with values 11 - 15 and 2 thru whatever. You can then recode the values of c and change your value labels to match.
Recode c (11=1)(12=2)(13=3)(14=4)(15=5) (2=6)(3=7) etc etc This saves messing about in the GUI. You can see a tutorial on syntax for data transformations on page http://surveyresearch.weebly.com/block-2-analysing-one-variable.html on my website. John F Hall www.surveyresearch.weebly.com -----Original Message----- Please provide a few lines of sample data that show exactly what A and B look like originally, and what you want the modified A variable to look like. And clarify whether the variables are numeric or string. Theoharisk wrote: > > Hi > > I am facing a problem with computing a new variable using SPSS. I have 2 > variables: One that shows respondents qualifications and another one which > shows the type of the highest of those qualifications. Let's name the > former > as ''A'' and the latter as ''B''. ''A'' variable includes values up to a > certain level of qualifications and the highest of those values is value > ''1'' which corresponds to holders of a Higher postgraduate degree. > Variable > ''B'' now only includes responders who have a higher postgraduate degree > classifying them into 5 different categories (Post Doc, PhD, MA, Msc, > PGcert). > I mention here that cases of value ''1'' of variable A and cases of all > values of variable ''B'' are exactly the same number (precisely 4837). > What I > want to do is to combine these two variables and create another one which > will include all cases of variable ''A'' replacing variable's ''A'' value > 1 > with all the values found in variable ''B'',. So the new variable will > have > exactly the same cases as variable ''A'' but more values by the > replacement > of value 1 with all values of variable 'B''. But the problem is that I > don't > know how...Please HELP!!! > ----- -- Bruce Weaver http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Adding-values-to-existing-variable-HELP-tp4406213p4406236.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
In reply to this post by John F Hall
Sorry guys
I appreciate your help but I can't really get it. I am about to quit... Really thanks again... |
Administrator
|
Open your data file, and close any other active data sets. Then open a new syntax window (File - New - Syntax), and paste the following syntax into it: * ----- Start of syntax ----- . do if A=1. /* higher degree . - compute AB = B. /* which higher degree (1-5). else. - compute AB = A+4. /* (2 -> 6, 3 -> 7, etc). end if. VALUE LABELS AB 1 "Doctorate" 2 "Masters" 3 "Post grad cert in educ" 4 "Other post grad degree or prof qual" 5 "Don't know" 6 "NVQ level 5" 7 "First/Foundation degree" 8 "Other degree" 9 "NVQ level 4" 10 "Diploma in higher educ" 11 "HNC,HND,BTEC etc higher" 12 "Teaching, further educ" 13 "Teaching, secondary educ" 14 "Teaching, primary educ" 15 "Teaching foundation stage" 16 "Teaching, level not stated" . * ----- End of syntax ----- . Notice that I've only done the value labels for the first 16 values of variable AB. You can finish the rest of them by copying and pasting the list below after the line for 16 "Teaching, level not stated". Be sure to format each line the same way as the first 16. Nursing etc RSA higher diploma Other higher educ below degree NVQ level 3 International Bac'te GNVQ/GSVQ advanced A level or equivalent RSA advanced diploma OND,ONC,BTEC etc, national City & Guilds advanced craft/part 1 Scottish CSYS SCE Higher or equivalent Access qualifications A,S level or equivalent Trade apprenticeship NVQ level 2 or equivalent GNVQ/GSVQ intermediate RSA diploma City & Guilds craft/part 2 BTEC,SCOTVEC first/general diploma etc O level, GCSE grade A-C or equivalent NVQ level 1 or equivalent GNVQ,GSVQ foundation level CSE below grade1,GCSE below grade c BTEC,SCOTVEC first/general certificate SCOTVEC modules RSA other City & Guilds Foundation/Part 1 YT,YTP certificate Key Skills Qualif Basic Skills Qualif Entry Level qualif Other qualif No qualif Don't know Are your variable names actually A and B? If not, change A and B to the proper variable names in the syntax. Then you should be ready to run the syntax. There are various ways to do that, but as you want to run it all, you could just click on Run - All. Having done that, look at your data file to see if the new variable has appeared--and assuming it has, get a frequency distribution for it, and crosstabulate it with the original A and B variables to check that things got converted as expected. HTH.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Hi again
I am still struggling with that. I am trying to find a solution on the web but it's impossible. I repeatedly tried to run it but the Syntax code you sent me but it doesn't work. The actual names of the variables are: A=hiqual8 and B=higho. What I run in the syntax is the following: ''do if hiqual8=1. /* higher degree . - compute Qual3 = higho. /* which higher degree (1-5). else. - compute Qual3 = A+4. /* (2 -> 6, 3 -> 7, etc). end if.'' where Qual3 denotes the new variable computed. Created and derived from hiqual8 and higho. After that I am getting that message in my output file: ''do if hiqual8=1. /* higher degree . - compute Qual3 = higho. /* which higher degree (1-5). else. - compute Qual3 = A+4. /* (2 -> 6, 3 -> 7, etc). >Error # 4285 in column 19. Text: A >Incorrect variable name: either the name is more than 64 characters, or it is >not defined by a previous command. >Execution of this command stops. end if.'' I mention here that there is another variable in the dataset I have, which is named as levqual8 and it consists of a hiqual8 summary: It has just 7 values where the first one is called ''NQF Level 4 and above''. This value includeS all respondents with first degree plus those with a higher postgraduate. I am just mentioning it in case it makes it less complicated Find attached the file with all 3 variables frequencies. Thanks once more, Theonew_file_3_freq_variables.docx |
Theo,
Bruce sent you the following syntax segment. do if A=1. /* higher degree . - compute AB = B. /* which higher degree (1-5). else. - compute AB = A+4. /* (2 -> 6, 3 -> 7, etc). end if. You modified it to read. do if hiqual8=1. /* higher degree . - compute Qual3 = higho. /* which higher degree (1-5). else. - compute Qual3 = A+4. /* (2 -> 6, 3 -> 7, etc). end if.'' I think you failed to make all variable substitutions. Specifically here: - compute Qual3 = A+4. /* (2 -> 6, 3 -> 7, etc). Should be, I'll bet - compute Qual3 = hiqual8+4. /* (2 -> 6, 3 -> 7, etc). Gene Maguin ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Administrator
|
In reply to this post by Theoharisk
You failed to change A+4 to hiqual8+4 on one of the lines--that's why you're getting the error. Try this:
do if hiqual8=1. /* higher degree . - compute Qual3 = higho. /* which higher degree (1-5). else. - compute Qual3 = hiqual8+4. /* (2 -> 6, 3 -> 7, etc). end if. VALUE LABELS Qual3 1 "Doctorate" 2 "Masters" 3 "Post grad cert in educ" 4 "Other post grad degree or prof qual" 5 "Don't know" 6 "NVQ level 5" 7 "First/Foundation degree" 8 "Other degree" 9 "NVQ level 4" 10 "Diploma in higher educ" 11 "HNC,HND,BTEC etc higher" 12 "Teaching, further educ" 13 "Teaching, secondary educ" 14 "Teaching, primary educ" 15 "Teaching foundation stage" 16 "Teaching, level not stated" .
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Indeed guys!!!
It works now!!!Cant find words to thank you!!! |
Free forum by Nabble | Edit this page |