BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jay_q
Calcite | Level 5

Hello

I have a inner loop which has a series Update statements which I need to loop it until update statement results from step N-1 is equal to one from Step N. Then I have to go back to outer loop.

the inner loop syntax would be:

Inner loop:

     %do J = 1 %to 200;

          a series update statements...

                    %if (update statement results from step J) <>(update statement results from step J-1) %then %goto leave_inner;

                    /* (in other words, if 1 row was updated in WORK.DATA from Step J-1 but  0 row was updated in WORK.DATA from StepJ, then we use %goto to leave the inner loop)*/

                      %end;

      %leave_inner: /* leave inner loop to outer loop*/

if there is a way to capture just the number of rows that was updated in update statement results log and then put it into a macro, that would solve my problem as well.

Thanks in advance for any ideas.

Lei

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Assuming that "update statements" refer to SQL UPDATE statements, you could get the number of records updated (not necessarily changed) after each query from the SQLOBS automatic macro variable.

PG

PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

Assuming that "update statements" refer to SQL UPDATE statements, you could get the number of records updated (not necessarily changed) after each query from the SQLOBS automatic macro variable.

PG

PG
jay_q
Calcite | Level 5

tested and works! Thank you. PGStars.

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