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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.