I have a table that looks like this:
| Col1 | Col2 | Col3 |
| 1st | ||
| 2nd | ||
| 3rd | Info | Info |
| 4th |
What I want to do is I will update the values of Col2 and Col3 by getting the value of Col2 and Col3 in the next row.
For example, after updating my initial table, it should now look like this
| Col1 | Col2 | Col3 |
| 1st | ||
| 2nd | Info | Info |
| 3rd | ||
| 4th |
Hello,
data have;
infile datalines truncover;
input Col1 $ Col2 $ Col3 $ ;
datalines;
1st
2nd
3rd Info Info
4th
;
data want;
merge have(keep=col1) have(drop=col1 firstobs=2);
run;
Hello,
data have;
infile datalines truncover;
input Col1 $ Col2 $ Col3 $ ;
datalines;
1st
2nd
3rd Info Info
4th
;
data want;
merge have(keep=col1) have(drop=col1 firstobs=2);
run;
I tried the program and it worked! thanks for helping! ![]()
There's got to be more rules that could apply to this update, no? What about id/by variables, sort order...?
Unless, you could just copy paste in a view data window....
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.