BookmarkSubscribeRSS Feed
llai1
Calcite | Level 5

Hi,

 

I am trying to run the code using CAS server instead of EG with the following code:

 

proc sql;
update mylib.dataset_a x
Set column_wanted=1
where exists (select column_A from mylib.dataset_b y
and x.person=y.person and x.date>=y.date
and y.date>=x.date-366);
quit;

 

Wondering what i should be putting in SAS Studio in order for it to work. Thanks!

3 REPLIES 3
ballardw
Super User

If you have a LOG you should show the log with the code and any associated notes, warnings or errors.

 

From what you posted you have a mismatched parentheses. Somewhere there should be a matching ).

proc sql;
update mylib.dataset_a x
Set column_wanted=1
where exists (select column_A from mylib.dataset_b y
             ^ 
and x.person=y.person and x.date>=y.date
and y.date>=x.date-366;
quit;

You may also need to be very cautious about use of "date - 366" without a lot of testing to make sure you are getting the correct boundary. Typically if your values are actually dates then using the INTNX function to increment dates is more reliable as it will account for leap day differences where a fixed number of days may not always do so.

llai1
Calcite | Level 5
thanks for the advice!
SASKiwi
PROC Star

What version of Viya are you using? Viya 4 (aka 202n.n.n) does not support Enterprise Guide.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 3 replies
  • 1302 views
  • 2 likes
  • 3 in conversation