Why yes you can. I am just finnishing up my 96 to 2002 motor swap. There are a few things you will need to remember.
1.) 99+ cars are returnless fuel systems so you will need to put you 97 fuel rails on
2.) my 96 car's oil pan had a level sensor so I had to swap over pans
3.) the bolts on the 99+ headers are different than the 96-98 so if you get headers with the motor you will need to swap over your 97 headers.
4.) the a/c pump line hook-ups are different so you will have to change over your a/c compressor if the 99 motor comes with it (proablly won't)
If you have any questions let me know.