BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
maryami
Calcite | Level 5

Hello, I am running a code that access a series of datasets in read-only mode to be used later in several computations.

The datasets are named like  ABC_yyyymm:

ABC_201501

ABC_201502

ABC_201601

ABC_201602

ABC_201701

ABC_201702

 

However some sets have their original name as EFY_yyyymm, e.g. EFG_201801, EFG_201802

 

How can I temporarily assign the names ABC_201801 to EFG_201801, and ABC_2018_02 to EFG_201802 so that the files data can be used during the code execution?.

 

-I am using SAS v7.13 HF5

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Sajid01
Meteorite | Level 14

Perhaps @maryami meant SAS EG 7.13 with Hot fix HF5

View solution in original post

4 REPLIES 4
ballardw
Super User

I think the safest would be to create views of those data sets, unless you are looking for an "automagic" process to guess which files need the exception to handling.

 

data abc_201801/ view=abc_201801;
   set EFG_201801;
run;

As an example. When you use the set Abc_201801 it pulls the data from the EFG named set.

Performance issue is that every use of the Abc version will read EFG version.

The view is just the instructions to get the data. If the EFG file is deleted or renamed the view won't work.

Tom
Super User Tom
Super User

How complex is the code?
Why not modify the code to store the prefix of the dataset name in a macro variable.  Then you just need to change the macro variable.

%let prefix=ABC;
*** Rest of code ***;
data x;
 set &prefix._201501;
...

PS There is no way you are running SAS 7.13.  There was not SAS 7.13 there was barely ever a SAS 7 as the real usable version of SAS went straight from 6.12 to 8.1.  You have probably posted the version of Enterprise Guide or some other tool you are using to help you send code to SAS to run.  To see what version of SAS you are running check the top of the FULL SAS log.  Or check the automatic macro variable SYSVLONG.

Sajid01
Meteorite | Level 14

Perhaps @maryami meant SAS EG 7.13 with Hot fix HF5

maryami
Calcite | Level 5

Indeed I was referring to EG, i.e. SAS EG 7.13 HF5, thanks

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 4 replies
  • 809 views
  • 2 likes
  • 4 in conversation