Hi Community,
I need your help with the below problem.
If the per ID rows count is <6 then I would like to add the additional missing rows with the Score = 0;
data Dsn; input ID score; cards; 1 48 1 45 1 50 1 42 1 41 2 51 2 52 2 43 2 52 ; run;
Expected Output:
Any help is appreciated.
Thank you for your time.
Best,
SC.
data Dsn; input ID score; cards; 1 48 1 45 1 50 1 42 1 41 2 51 2 52 2 43 2 52 ; run; data want; do _n_=1 by 1 until(last.id); set dsn; by id; output; end; do _n_=_n_+1 to 6; score=0; output; end; run;
View solution in original post
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Latest Updates
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.