BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I am new to SAS programming. I have a requirement where i need to get the result of a SQL query into a variable and use it in another data step later for validation.

Eg:
I get the Current YEAR as the RESULT of my query. I need to use this date to validate the accounts that needs to be loaded to the final dattabase. I will be using "if" condition in the datablock to validate this.

Kindly let me know how to attain this.

Regards,
Prashant
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You can use PROC SQL and generate a SAS macro variable based on your data criteria. Then in the subsequent DATA step, you can reference this macro variable in one of several ways - likely as a data-constant or possibly as a RETAIN statement variable -- note that either choice must be wrapped in double-quotes, not single-quotes.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search arguments, this topic/post:
proc sql macro variable into site:sas.com
retain statement macro variable site:sas.com

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1452 views
  • 0 likes
  • 2 in conversation