Hi all, using sas 9.4 on a windows platform (coming to SAS from C/C++ and Python background): I'm using an array to compare a string variable with a list of strings to set a flag variable. This code works for a single variable, and it works in a different dataset (basically the same code) but when I try to use it with this dataset I am not getting any results. Here's the main idea (pseudo-sas): if this_one_code IN: (<list of strings>) then do;
flag = 1;
date = this_date
end;
/* The above works fine and the flags are set for valid variables */ /* now I try the same over the other codes: */
array dx(24) code2-code25;
do i = 1 to 24;
if dx[i] IN: (<list of strings>) then do;
flag = 2;
date = this date; When I hit this array though, I get errors of "character values converted to numeric" for every conditional inside the array do block. It works without the dollar sign in another program using the same code and string variable lists. I thought SAS would be smart enough to get the string implicitly but I guess that's not the case. I tried correcting this by adding the $ before the variable: array dx(24) $code2-code25; This silences the error, but I get no results from the logic in the loop. What I would like to know is: Is this array declaration for an array of strings correct? If not, what should I do to correct? Are there any other noticable issues? Thanks.
... View more