- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.