Hi:
I'm not sure why this is in a Macro program and I don't have a clear picture of your input data and your desired output. However, it seems to me that you have named the array as "DRUG_" but then later in the program, you refer to the array item as "DEUG_".
What do you see in the SAS log after you run this code? Can you post a better example of what you expect your output to look like. It seems to me that all you really want to do is put each drug into a numbered variable, where the number for any drug corresponds to the number in [] as in. But you only show one "cell" of data. Are the numbers in brackets always in order, as you show? Or, could the numbers in the brackets be out of order like this:
"Isoniazid[1] | Rifampin[2] | Streptomycin[4] | Montelukast[3]"
Is it possible for something like this to happen where there are only 10 drugs listed but the numbers in the brackets are more than 10? This could cause issues if your array is defined only to have 10 members, but your program tries to write to a member greater than 10:
Isoniazid[11] | Rifampin[12] | Pyrazinamide[13] | Ethambutol[14] | Streptomycin[15] | Rifapentine[16] | Ethionamide[17] | Amikacin[18] | Kanamycin[19] | Streptomycin[20]
I don't really understand the data and the desired results well enough to comment in more detail. My first suggestion is to fix the typo in the code. As always with Macro programs, my first suggestion is to always start with a working program that is NOT in a macro definition and make sure your program logic works correctly first before macro-izing your program.
Cynthia
... View more