DATA Step, Macro, Functions and more

Documenting variables throughout the programming process

Occasional Contributor
Posts: 9

Documenting variables throughout the programming process

I am working with code that starts with some data, does some processing and changes variable names, does some processing that combines information from variables in more than one dataset, changes some of the variable names, brings in other data and changes names to variables, and on and on...


There's hundreds if not a thousand variables.  I'd like to create something that shows the entire flow where you can look for a variable name in one dataset and see where it came from and where it's going.


Does anybody know where I can start?  I haven't been using SAS EG in a while but I'm wondering if the code were in SAS EG if there was a feature in there that would help?  


I'm using SAS 9.4 for Windows.  I have a bit of experience with EG, it's just been a while but I think I could move what I have over to it if need be.

Posts: 2,350

Re: Documenting variables throughout the programming process

EG doesn't do this unfortunately.

If you can create a process that parses the code and checks the metadata of the tables used and creates a documentation with what you want, you can probably sell it successfully! Smiley Happy

Super User
Posts: 13,542

Re: Documenting variables throughout the programming process

IF you a "changing names" using the Rename statement in its various forms you might have a chance using a number of code parsers (look for them). If your names come from things like proc transpose or the output datasets of procedures like summary, tabulate, means, report and the like it may be very difficult just to implement that code search.


What I might suggest would be to look at your processes and insert appropriate calls at the beginning to read the dictionary tables for pertinent data, save it with a name like VarsStartProcXXXX and then repeat at the end of the process to VarEndProcXXXX (keep the names matching). While it won't give the direct change you at least can build something searchable. If you use labels in your code for the variables it would be even more useful.


I will say that seeing that many name changes makes me a bit concerned about the overal process, most likely the data import. But I may be picky about the start of things.

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation