Please post your questions only once.
Not exhaustive list of possible keywords:
For input:
from, join (for sql)
set, merge, modify
dataset: (when loading a data into hash)
For output:
create table
create view
out (for Procs)
data
And then you have also cases like below where SAS replaces the table without an out= or similar keyword:
proc sort data=mytable; by some_var; run;
And then there is also SQL UPDATE, INSERT and DELETE.
...and last but not least: Formats and Informats.
And data set UPDATE
ODS OUTPUT.
Some procedures like Proc Compare can create more than one output data set such as with the OUTSTATS= and uses Base= and Compare= as input data.
Proc Append with Base= and Data= input sets.
How about Proc Datasets and renaming data sets? Does that count?
Many procedures use more than one input data set. Proc Gmap for example has Data, Map and annotate as proc options and will accept additional Annotate data sets for each plot option.
Graphics procedures also have the annotate and may have helper data sets in SGplot for DATTRMAP and Rattermap data sets.
Survey procedures often have additional data set to deal with Sample information with names like Rate(R), Total, N, Sampsize, Samprate, Certsize, Maxsize and a bunch of others that may be data sets or values/value lists.
For the future you might want to consider the use of SASjs for documenting your SAS jobs.
If your developers follow the approach, you can generate Data Lineage diagrams (inputs/outputs) directly from the program headers.
Here are the docs: https://cli.sasjs.io/doc/
As Reeza says, proc scaproc is the tool you need.
Run this code and look at your sas log : a lot of information is written there
Doc : https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0pbvhhaw4f7f7n1ukrvacsgulx1.htm
/* start gathering data - add timestamp + variables-related information */
options msglevel=I;
proc scaproc;
record '!temp/record.txt' attr OPENTIMES;
run;
data a(keep=i index=(i)) b(keep=i j k) ;
do i = 1 to 1e7;
j = round(i,1e6);
k=sin(i);
if mod(i,2)=0 then output a;
else output b;
end;
run;
ods output Univariate.j.BasicMeasures=BasicMeasures;
proc univariate data=b;
var j;
run;
ods output close;
proc summary data=b;
class j;
var k;
output out=summary sum=;
run;
proc sql;
create table c as select * from a where i < 100;
proc means data=a;
run;
/* write results to text file */
proc scaproc;
write;
run;
/* examine what has been generated */
data _NULL_;
infile '!temp/record.txt';
input;
put _infile_;
run;
Instead of scanning programs, scan logs. The NOTEs detailing datasets read and datasets written are quite standardized and much easier to parse than program statements.
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.