I read SAS programs as 1000 character text variables. I then can, as Cynthia suggests, use various search methods like a WHERE statement to find DATA STEPS and extract only those lines or mark the line number in the program to know the beginning and end of the DATA STEP. Or I can do a character search of that first keyword in a DATASTEP like DATA nameofdatset; to extract "nameofdataset.". I can find what the line number is for the beginning of that DATA STEP. I generally create an (_n_) based variable to define the line numbers to match the text variable containing the SAS program where one line of code is one observation.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.