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.
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.