Hello all, I'm new to SAS , and I'm really tired of this problem I keep running into, but I can't figure it out. I need to categorize data all the time with new character variables based on numeric values of another variable, e.g.: This works fine: if dm_prev_adj < Q1_dm then dm_prev_lvl = 'Low'; The "issue" is that it is horribly inefficient. I have to do this for each level, for each variable.. in this instance it is only nine lines of code (3 variables, 3 levels), but I have to believe that a do loop can do this easier. When I use a do loop and a numeric value it works fine for numbers: do i = 1 to 3; if adj(i) <= q1(i) then lvl(i)=1; else if q1(i) < adj(i) < q3(i) then lvl(i)=2; else lvl(i)=3; end; But if I change those numeric values to words, aka 'Low' 'Medium' 'High' it bombs out and says: NOTE: Invalid numeric data, 'Low' , at line 1451 column 32. NOTE: Invalid numeric data, 'High' , at line 1453 column 13. NOTE: Invalid numeric data, 'Medium' , at line 1452 column 44 over and over and over... This seems really easy but I cannot find the answer, would appreciate any help or alternatives.
... View more