DATA Step, Macro, Functions and more

How to append all files with regex?

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 99
Accepted Solution

How to append all files with regex?

I've sas tables with the following names:

cch_010317

cch_020317

etc

 

what i want is

data want;
set cch_*; run;

Accepted Solutions
Solution
‎04-04-2017 03:22 AM
Super Contributor
Posts: 441

Re: How to append all files with regex?

Posted in reply to afiqcjohari

You don't really need a regex - just put a colon after the prefix of the table name in the SET statement i.e.

 

data cch_0103017;
   input val;
   datalines;
100
200
;
run;

data cch_0203017;
   input val;
   datalines;
300
400
;
run;

data cch_0303017;
   input val;
   datalines;
500
600
;
run;

data want;
	set cch_:;
run;

View solution in original post


All Replies
Solution
‎04-04-2017 03:22 AM
Super Contributor
Posts: 441

Re: How to append all files with regex?

Posted in reply to afiqcjohari

You don't really need a regex - just put a colon after the prefix of the table name in the SET statement i.e.

 

data cch_0103017;
   input val;
   datalines;
100
200
;
run;

data cch_0203017;
   input val;
   datalines;
300
400
;
run;

data cch_0303017;
   input val;
   datalines;
500
600
;
run;

data want;
	set cch_:;
run;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 113 views
  • 1 like
  • 2 in conversation