BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Beto16
Obsidian | Level 7
Hi team I was able to import 180 datasets to work. same columns each file has 35k records they are all title with date it was produced. . For example
D160101. D160102. D160103. D160104 ...
I have hundreds datasets how can I create a macro to append all of them ? Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

They all start with D? Do you have other datasets in the library that you need to exclude?

 

You can do it without a macro, using the colon short cut. This will append all datasets that start with the letter D.

 

data want;
set D:;
run;

If you need a macro and want to use proc append, I would use the following method:

 

1. Write macro to use PROC APPEND

2. Obtain list of dataset name from sashelp.vtable -> store in a dataset

3. Use call execute to execute macro from #1. 

 

 

View solution in original post

6 REPLIES 6
Reeza
Super User

They all start with D? Do you have other datasets in the library that you need to exclude?

 

You can do it without a macro, using the colon short cut. This will append all datasets that start with the letter D.

 

data want;
set D:;
run;

If you need a macro and want to use proc append, I would use the following method:

 

1. Write macro to use PROC APPEND

2. Obtain list of dataset name from sashelp.vtable -> store in a dataset

3. Use call execute to execute macro from #1. 

 

 

Beto16
Obsidian | Level 7
Thanks Reeza that worked
Reeza
Super User

Why did you mark your answer as correct?

Beto16
Obsidian | Level 7
Reeza. data want; set D:; run; this appended all the files that start with D it's what I was looking for
Cynthia_sas
SAS Super FREQ
But it was Reeza's answer that was correct. You marked your response as correct, not her answer.
cynthia
Beto16
Obsidian | Level 7
Oops I didn't see that's what I did my error

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

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
  • 6 replies
  • 3176 views
  • 2 likes
  • 3 in conversation