Hi all,
My data set is Like This,
data chk;
input x;
datalines;
12
23
34
11
45
;
Run;
And My desired Output Look Like,
12
12
23
12
23
34
12
23
34
11
12
23
34
11
45
So Pls Guys Help Me out in this problem. Your Valuable Suggestion appreciate.
Thanks In Advance.
Regards,
Dishant Parikh
dishant
please
before I offer a solution
why!
is it really just a repeat of the first N obs where N goes from 1 to 5?
Message was edited by: Peter Crawford
Hi peter,
Actually I am Creating one Macro This Solution Will Helpful me a lot.
can you help me to reach the required output ,it would be grateful.
data fun;
do y= 1 to _n_ ;
set chk point= y ;
output ;
end ;
if _n_ >= 5 then stop ;
run ;
Hi Peter,
Thanks A lot For giving the answer and your valuable time.This Solution Will Helpful me a lot.
One More Question we can do with the any other logic or procedure?
Why is that not an adequate anserr?
did your One Macro need something else?
Message was edited by: Peter Crawford
Hi Peter,
yeah obviously its adequate answer and it takes me new level of thinking but as per your logic we need to pass total _n_ in if condition.
If suppose data get updated and few more observation added then again we need to change the if condition right?
So is their any logic in dynamic way.
Thanks In advance.
what error messages are you getting?
If you visit the online documentation regarding the SET statement you will find the NOBS option. Which should suffice for what you call "total _N_".
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.