BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dbillig
Fluorite | Level 6

I have several datasets I'm trying to set together, but don't want to type each one manually because there are hundreds.  Is it possible to use a wildcard to set them together somehow, like you can do in an Infile statement?  I've tried Data MyFile; Set MyFile*; Run; but get a syntax error. 

Thanks for any help

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

That was added in 9.2.  If you still have an older version, you could either use a pipe or proc sql to accomplish the same thing.  E.g.:

proc sql noprint;

  select memname into :names

    separated by " "

      from dictionary.tables

        where libname eq "WORK" and

          memname like "HAVE%"

;

quit;

data want;

  set &names.;

run;

View solution in original post

5 REPLIES 5
art297
Opal | Level 21

Try it with set Myfile:

dbillig
Fluorite | Level 6

Thanks, just tried it however gave me a syntax error again, with the cursor on the ":", very weird...

art297
Opal | Level 21

On SAS 9.2 it works for me.  My log shows:

40   data want;

41     set have:;

42   run;

NOTE: There were 7 observations read from the data set WORK.HAVE.

NOTE: There were 7 observations read from the data set WORK.HAVE1.

NOTE: There were 7 observations read from the data set WORK.HAVE2.

NOTE: The data set WORK.WANT has 21 observations and 1 variables.

NOTE: DATA statement used (Total process time):

      real time           0.07 seconds

      cpu time            0.01 seconds

art297
Opal | Level 21

That was added in 9.2.  If you still have an older version, you could either use a pipe or proc sql to accomplish the same thing.  E.g.:

proc sql noprint;

  select memname into :names

    separated by " "

      from dictionary.tables

        where libname eq "WORK" and

          memname like "HAVE%"

;

quit;

data want;

  set &names.;

run;

dbillig
Fluorite | Level 6

Perfect, got them both to work.  I'm in Enterprise Guide 4.1 which explains why the colon trick didn't work at first, although as soon as I flipped over to PC SAS 9.2 it worked.  The Proc SQL statement worked in both places.  Thanks!!

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 12591 views
  • 6 likes
  • 2 in conversation