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.

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