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. 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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