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
Diamond | Level 26
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 5017 views
  • 2 likes
  • 3 in conversation