Hi SAS community! Finally going to bug you with a question, now that I've been learning from you Super Users for months. (You are an amazing resource -- I can't figure out how much time you're spending on all this or why, but I really admire what you do here and hope to get to your level!) This may be more of a programming logic question, unless there's a function I'm not aware of that would accomplish this task. I have given SAS a list of objects and stored it in a macro list which now looks like this: %put &ObjectList; "Object1" "Object2" "Object3" "Object4" "" "" Now I want to get fancy and put it in a condition for proc freq: proc freq data=tatertots; tables var1*var2; where propcase(strip(var1)) in(&ObjectList.) and var1 ne ""; run; In my head, this made perfect sense when I wrote it, but the data looked suspicious. Then I realized, my var1 contains observations which have multiple objects, such as this one: Obs Var1 1 object1, OBJECT4, Object3 Clearly I was asking SAS so search the entirety of propcase(strip(var1)) within &ObjectList, so when there was no match for that entire string it skipped those observations. I can probably solve this by parsing out var1 to be multiple variables with one object each and adding those conditions to my proc freq. I've had luck doing this with a new dataset via arrays and do loops in the past. I've been practicing using index, scan, substr and some basic character modifying functions, but as far as I know I'll have the same problem with those. I guess I want to know what a seasoned, efficient programmer would do because I have the feeling there's something I don't know that doesn't require making a whole new dataset. What would you do? Also, in your answer, would you mind including your favorite resource for learning to write macros? Or perhaps share how you learned? I'm really wanting to get better at that and I want a good teacher. Thanks again for everything you do, and hope my question makes sense and falls within community guidelines.
... View more