BookmarkSubscribeRSS Feed
RDellaVilla
Fluorite | Level 6

Hello, 

I am having an issue with a procedure I need for a research application. 

I am dealing with several datasets, each for a given year, since 1996 to 2020. These datasets are composed of the same columns. Namely, I have a series of files named optionm.opprcdyyyy with yyyy ranging from 1996 to 2020.

All I want to do is to create a unique file listing all of the annual datasets together.

 

I have then to apply some filters. I think that by creating a unified document I could much more conveniently apply my filters. 

 

I am aware this is quite trivial, but I have been stuck on this for quite a long time. 

 

Could anybody help? 

 

Thanks 

2 REPLIES 2
mklangley
Lapis Lazuli | Level 10

It sounds like you want to combine the opprc1996 through opprc2020 datasets from the optionm library into a single dataset?

data want;
    set optionm.opprc1996 - optionm.opprc2020;
run;

 

Reeza
Super User
data combinedData;
set optionm.oppr: indsname=source;
source_file=source;
run;

Here is a reference that illustrates how to refer to variables and datasets in a short cut list:
https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html

 

You can use short cut lists as noted in the blog posts. The INDSNAME will store the name of the original file in a variable called source_file. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1090 views
  • 0 likes
  • 3 in conversation