BookmarkSubscribeRSS Feed
RajasekharReddy
Fluorite | Level 6

can any one explain do loop working sceneria in follwing citation

data xx;

do i= 01 to 04;

j=01 to 04;

output;

end;

run;

8 REPLIES 8
Kurt_Bremser
Super User

There is no "working scenario", because:

20     do i= 01 to 04;
21   
22     j=01 to 04;
            __
            388
            202

ERROR 388-185: Expecting an arithmetic operator.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

yeliu
SAS Employee

I think the program is either trying to do this:

data xx;

do i= 01 to 04;

j=i;

output;

end;

run;

or:

data xx;

do i= 01 to 04;

do j= 01 to 04;

output;

end;

end;

run;

Jagadishkatam
Amethyst | Level 16

As per the code provided by @yeliu , first the internal do loop of j will execute and then the outer loop of i.

Thanks

Jag

Thanks,
Jag
RajasekharReddy
Fluorite | Level 6

thanks for clarifying code however i am asking how works do loops in sas with diffrnc scenerios likewe put "output" after  "end"and before "end"

Tom
Super User Tom
Super User

Why not just runs some test programs and find out?

RajasekharReddy
Fluorite | Level 6

i had run some test programs but i can't understand do loop working method in sas

RajasekharReddy
Fluorite | Level 6

can any one send link foe base do loops working method in

sas

Tom
Super User Tom
Super User

Post an example of the code you tested and a specific question about it.

A simple iterative DO loop like in your original question work the same as in any other language.

The DO statement in SAS actual has many variations and can be extremely powerful, but without more details of what you are trying to do it is hard to give specific advice.

Here is link to on-line document for the iterative form of DO.

SAS(R) 9.4 Statements: Reference, Second Edition

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 2054 views
  • 0 likes
  • 5 in conversation