03-21-2017 03:09 PM
I am having trouble with my sas code, specifically with this line:
else if substr(major1,1,6) in ('422704','422801') and degree_level='D' then isSTEMH1='Y'; The full data step code is in the attached word document.
I know for a fact that there are records with these CIP codes and it is not classifying them correctly when i run the full data step.
03-21-2017 03:21 PM
Post your code directly into the forum using a code block please.
I think it's a logical error - your data is meeting a classification in a IF statement before the IF statement you're trying to assign.
IF statements are evaluated in order, and if one is evaluated as TRUE then it exits the IF block.
Verify your logic.
If you need further help, please post some sample data - ideally records from your data that you know should work but aren't and include the code/log and output you expect vs what you get.
03-21-2017 04:39 PM
Reeza is right, there are few problems with your IFstatement.
For example, you are evaluating string '13120601' three times:
- in the very first IF, in conjunction with fice and academic_year,
- then few ELSE IFs later - just '13120601';
- and in the next line - first six characters of it - '131206' and fice='00200200'.
It would really be helpful to know what question are you trying to answer? Do you need to know three things - first major was STEM-H, second major was STEM-H, any of the majors was STEM-H? Or just one - any of the majors was STEM-H?