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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 720 views
  • 1 like
  • 3 in conversation