I had some random data in that data i want to add some data in between that already existed data by using under EmpID.
data Examplex;
input EmpID $ Name $ Designee $ 27-39 Department $;
datalines;
101 Madhu Jr Associate QA
103 Sathwik Jr Associate PB
104 Mohan Manager PB
106 Raja Manager QA
107 Kiran Manager BR
108 Sainath Manager CL
;
run;
proc print data = Examplex;
run;
We want to add data which is given below
102 Satya Sr Associate PB
105 Sai Trinee BR
109 Surya Manager CL
I'm expecting this out put.
thank you
Sathwik
Hello,
data Examplex;
input EmpID $ Name $ Designee $ 27-39 Department $;
datalines;
101 Madhu Jr Associate QA
103 Sathwik Jr Associate PB
104 Mohan Manager PB
106 Raja Manager QA
107 Kiran Manager BR
108 Sainath Manager CL
;
run;
data new;
input EmpID $ Name $ Designee $ 27-39 Department $;
datalines;
102 Satya Sr Associate PB
105 Sai Trinee BR
109 Surya Manager CL
;
run;
data want;
merge Examplex new;
by EmpID;
run;
Hello,
data Examplex;
input EmpID $ Name $ Designee $ 27-39 Department $;
datalines;
101 Madhu Jr Associate QA
103 Sathwik Jr Associate PB
104 Mohan Manager PB
106 Raja Manager QA
107 Kiran Manager BR
108 Sainath Manager CL
;
run;
data new;
input EmpID $ Name $ Designee $ 27-39 Department $;
datalines;
102 Satya Sr Associate PB
105 Sai Trinee BR
109 Surya Manager CL
;
run;
data want;
merge Examplex new;
by EmpID;
run;
If by position, you mean row number, you can use _N_ to get the currently processed row index
and, when the condition is met, read data from your alternate dataset :
data want;
set Examplex;
output;
if _N_=5 then do until(eof);
set new end=eof;
output;
end;
run;
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.