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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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