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. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 503 views
  • 0 likes
  • 3 in conversation