Stargazer
Stargazer

Reputation: 21

What does the colon mean when located after the set statement, in SAS?

I have the following code and I don’t know what SAS is doing here.

data have;

set folder.pst:;

if.....

run;

Now, there are several datasets that are named ”pst201812”, ”pst201901” and ”pst201902” in the libname called folder. Does the colon in the code above mean that ALL the datasets starting with pst are read by SAS? Or have I misunderstood?

Upvotes: 2

Views: 909

Answers (1)

PeterClemmensen
PeterClemmensen

Reputation: 4937

You got it right. The Set Statement with the Colon operator reads all datasets that begin with pst in this case. See a small example below and read the "Using Data Set Lists with SET" section of the Set Statement Documentation.

data pst201812;a=1;run;
data pst201901;a=2;run;
data pst201902;a=3;run;

data want;
   set work.pst:;
run;

Upvotes: 4

Related Questions