BookmarkSubscribeRSS Feed
langalife
Calcite | Level 5

Good day

I am new to sas ds2. I kindly request an assistance.

I have been trying to create a macro variable using 2 methods.

using select into: and call symput but both does not work

 

proc ds2;
data _null_;
method run();
SET {select interest_rate into :rate from elookup.interest_rate where
information_date in (select max(information_date) from
elookup.interest_rate) where infomation_date=max(infomation_date)};
end;
enddata;
run;
quit;

 

i am getting this error below.

 

ERROR: Compilation error.
ERROR: Syntax error at or near ":"
ERROR: Line 79: Unable to prepare SQL query (rc=0x80fff802U).

5 REPLIES 5
Tom
Super User Tom
Super User

You cannot have an SQL SELECT statement that both returns its results as a dataset and also generates macro variables.

Since you are using the SELECT statement to return data to your DS2 data step remove the INTO clause from the SQL.

Or if you just want to set macro variables then use PROC SQL instead of PROC DS2 to run the SELECT statement.

langalife
Calcite | Level 5

Hi 

 

I have tried Fedsql I didn't come right. 

ChrisNZ
Tourmaline | Level 20
langalife
Calcite | Level 5

hi there is a thin line between sas and sas ds2, which in my mind proc sql is being replaced by fedsql.

ChrisNZ
Tourmaline | Level 20

> proc sql is being replaced by fedsql.

No at all. Different tools for different purposes. 

Likewise DS2 does not replace the data step. DS2 is better some some tasks (heavy multithreading on distributed platforms) and much slower on the wrong hardware.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 984 views
  • 1 like
  • 3 in conversation