BookmarkSubscribeRSS Feed
Kody_devl
Quartz | Level 8

I am an experienced developer in everything but SAS.

 

I have a Dataset --->   "Periods" with a single column and 12 periods:

 

YYYYPP

201605

201604

201603

201602

....

...

 

I want step thru each data format in the Periods table, run an query to pull based on each of the 12 dates, by setting the current period equal to a variable and using the variable as criteria for the pull. 

 

I can do all parts of this except the looping part of the code. 

This is my approach and I can't get it to work.

 

%Macro macro1;

%Do i = 1 %To 12 %By 1;

 

call symputx ('YYYYPP',trim(YYYYPP));

 

RunQuery using &YYYYPP.

 

%end

%Mend macro1; %macro1;

 

Any Help is appreciated in advance.

 

Thank you.

 

1 REPLY 1
LinusH
Tourmaline | Level 20

Typically, this is done via a call execute() in a data _null_ step.

But what kind of pull do you need to do?

Perhaps it could be solved in a simple SQL join?

Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1 reply
  • 732 views
  • 0 likes
  • 2 in conversation