I'm a peculiar situation where I appear to get different results from a particular macro if the macro is called first in the code versus if it's called later in the code (presumably after the macro has been called with other parameters). I would generally expect a macro to return the same results if giving identical parameters.
I haven't been able to reproduce this "error" in a more controlled manner (hence the lack of test code), but my macro uses PROC LOGISTIC to create a model from a subset of my data, save the results (list of variables, etc) to a given "total" dataset, The intention is for the macro to be run several times to work on different subsets of the data and append the results to that same "total" dataset for later output.
Any tips on troubleshooting this?
I do sincerely apologize for the unorthodox question without proper test code, but I appreciate any suggestions/tips.
Things to check - the scope of your macro variables. Are you accidentally setting/resetting something?
Or modifying your data at some point and then running your model? Are you using a model selection method?
Things to check - the scope of your macro variables. Are you accidentally setting/resetting something?
Or modifying your data at some point and then running your model? Are you using a model selection method?
When you say "several subsets" of the data, I'm picturing randomly selected subsets. That could automatically make the results slightly different each time.
Even if you are controlling the seed for the random selector, the data set may be different. For example, it may be sorted differently later in the program, causing the random selection to choose a different sample (even when the seed has not changed).
In this particular situation, I'm using a relatively simple "filtering" method, but as a side note, I do use have a similar macro that does randomly subset data, and I didn't know about the effect of sorting on random selection (despite using the same seed). I'll have to remember that!
Thank you very much for your thoughts!
Hidden side effect. One of your macro variables you assume to be local might be global. Or a dataset that you assume to he static is actually changed.
Without code, and data to test it against, we can only guess.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.