@zsmith93 There is another approach you can use in SAS, using a custom FORMAT and the PUTC function
Click on links for documentation. If for example you just want to produce a report, then there is no need to generate the extra variable (classification) you could just output the m_major variable in a report and apply the custom format ($stem). This saves space in your dataset and processing time, as you don't have to run through the dataset twice to generate a report.
/* Create example dataset */
data collegepayback ;
input m_major : $20. ;
cards ;
Physics
Geography
Arts
English
;
run ;
/* Create a Custom Format */
proc format ;
value $stem
"Physics","Geography" = "STEM"
OTHER = "nonSTEM" ;
run ;
data newTable ;
set collegepayback ;
/* PUTC function applies the $stem format to m_major, converting it to STEM/nonSTEM */
classification=putc(m_major,"$stem.") ;
run ;
... View more