BookmarkSubscribeRSS Feed
J_hoon
Calcite | Level 5

Hi

 

I want to fill the data.

 

The same IDs have the same value.

 

For example, See under table.

 

제목 없음.png

 

I want to fill 12th row in Dose Group '10 mg' using do loop

 

becaues, 11th row and 12th row are same Subject Number.

 

Likewise, 13th row and 14th row, 15th row and 16th row has same value.

 

How can I do that? Please help me.

 

 

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

You can do something like this

 

data MyData;
input Subject $ DoseGroup $;
datalines;
2001 10mg
2001 .
2002 10mg
2002 .
2003 10mg
2003 .
;

data Want;
   update MyData(obs=0) MyData;
   by Subject;
   output;
run;
 
proc print data=Want noobs;
run;
Kurt_Bremser
Super User

Can we assume that a missing value for the dose group is ALWAYS preceded by a non-missing value? Or could it be that the first value for a subject is already missing?

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 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 584 views
  • 0 likes
  • 3 in conversation