@byeh2017, pay attention, the meaning of each line in next skilton code:
DATA libref.dsname; <<< defines output dataset to a library given by libref, dataset name given as dsname.
SET libref.dsname; <<< defines input dataset from a library given by libref, dataset name given as dsname.
... any sas code need to produce output from input ...
RUN; <<< closes the data step ready to check syntax and execute .
DATA and SET may be assigned to different datasets, either differ by libref or by dsname or by both.
In case they are both assigned to same libref and dsname, sas will create a new dataset and replace the original.
There are also other ways to define input, beside of SET statement, like INFILE to read
external (not sas) file as xxx.txt or xxx.csv or DATALINES.
Anyhow, usually you need INPUT to create OUTPUT.
... View more