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

For the below table, I need the first combination of "A, 194 and 2" to be duplicated or repeated 23 times and the second combination to be duplicated or repeated 14 times.

This code worked on another example but failed on this one. Any help?


do _N_= 1 to Domain;

output; end;

 

Error: "Invalid DO loop control information, either the INITIAL or TO expression is missing or the BY expression is missing, zero,
or invalid."

 

NAMEBR_CODEBKTDomain
A194223
A194314
A19448

 

Repeated 23 times...

 BR_CODEBKTDomain
A194223
A194223
A194223
A194223
A194223
A194223
A194223
A194223
A194223
A194223
A194223
A1942….
A1942….
A1942….
A1942….
1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

I suspect this happens because Domain = . in one of the obs. Try this

 

data have;
input NAME $ BR_CODE BKT Domain;
datalines;
A 194 2 23 
A 194 3 14 
A 194 4 8  
A 194 4 .  
;

data want;
   set have;
   do _N_ = 1 to max(Domain, 0);
      output;
   end;
run;

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

I suspect this happens because Domain = . in one of the obs. Try this

 

data have;
input NAME $ BR_CODE BKT Domain;
datalines;
A 194 2 23 
A 194 3 14 
A 194 4 8  
A 194 4 .  
;

data want;
   set have;
   do _N_ = 1 to max(Domain, 0);
      output;
   end;
run;
DDawaba
Calcite | Level 5
Yes! Thanks.
The variable contained (.)

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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