good day,
here is my program,
data have;
input name $40.;
infile datalines dlm=',';
datalines;
A
AAAOTAXIUNION
AACARPETSDELHI
AADESIGNFURNZTURNSAMUTPRAKAN
AADRIVERTRAININGLTAUCKLAND
AAFOOTWEARCENTRALWORBANGKOK
AAFOOTWEARGAYSORNBANGKOK
AAFOOTWEAROUTLETAYUTTAYUTTHAYA
AAHONGKONG
AAMCLENNANGKMPOKOLBIN
;
run;
data have2;
set have;
lag_name=lag(name);
run;
i also want to add a lead Row here for comparison. can anyone help?
thanks in advance
Try this
data have2;
merge have
have(firstobs=2 rename=(name=lead_name) keep=name);
lag_name=lag(name);
run;
Try this
data have2;
merge have
have(firstobs=2 rename=(name=lead_name) keep=name);
lag_name=lag(name);
run;
HI @harrylui
Could you try the same code with the following option before:
Options mergeNoBy=noWarn ;
Please check that the MERGENOBY System Option is set to NOWARN.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.