Q: I'd like to find unused symbols in my GAMS models, e.g. sets and parameters that are declared but never used: not assigned to or referenced. I can look at the $onsymxref output but is there something that just tells me the unused symbols?
You can get that information from a symbol reference file. Add the command line option
text is the name of your reference file to your GAMS command line. All symbol references will be written to this file.
If you use the GAMS IDE, click on the line in your process window, which starts with
— RefFile ..
and you will get the contents of the reference file (here
trnsport.ref) nicely organized. The last tab (unused) shows the unused symbols. A double click on of the entries will get you to the corresponding position in the source file.