Well, it's easy, particularly with Portland and Seattle.
Get on the train in Santa Barbara. Get off the next afternoon in Portland. Stay as long as you like. Cost will depends on the day you go and also whether you want a coach seat or some sort of sleeping accommodation.
Buy a ticket to seattle (there are 4 cascades trains per day between the cities, fare is $28). Stay there as long as you like.
Buy a ticket to Vancouver. One train a day. $30.