BookmarkSubscribeRSS Feed
MateoAnthony
Calcite | Level 5

I still a novice so forgive me if this is stupid. I am attempting to run the set of programs twice in a row for two different time periods. I set variables that go into 2019 tables and put together the tables I want then I reassign the variables to go into 2018 tables and pull the data. I can't bring 2019 and 2018 in together because the tables they pull from are different (there isnt one table with both 2018 and 2019 data) and also sometimes I may only want to pull for one time period.

Why does sas not let me run two ordered lists in a row that have some of the same programs in them?

2 REPLIES 2
Kurt_Bremser
Super User

Start with code that does it once, for one time period.

Identify all elements that need to be changed for a different time period (dates, dataset names, ...).

Replace those elements with macro variables, and set those macro variables in a preceding first code in your ordered list (process flow). If possible, try to reduce manual settings and instead calculate all macro variables out of one source, like

%let year=2019;

data _null_;
call symputx('begin',mdy(1,1,&year.);
call symputx('end',mdy(12,31,&year.);
call symputx('indataset',"inlib.indata&year.");
run;

so you end up with one process flow where a single change controls the whole logic.

ballardw
Super User

@MateoAnthony wrote:

I still a novice so forgive me if this is stupid. I am attempting to run the set of programs twice in a row for two different time periods. I set variables that go into 2019 tables and put together the tables I want then I reassign the variables to go into 2018 tables and pull the data. I can't bring 2019 and 2018 in together because the tables they pull from are different (there isnt one table with both 2018 and 2019 data) and also sometimes I may only want to pull for one time period.

Why does sas not let me run two ordered lists in a row that have some of the same programs in them?


You probably should show the code you attempted and preferably include the LOG that shows any messages from the attempt.

SAS is likely not the issue but the logic of the code you attempted.

 

You may also need to describe where your "list" resides. The typical data structure called a "list", as far as my experience with SAS goes, involves the SAS/AF and SAS/FSP modules.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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