That was my motivation for buying when I first did.
Figure out if your house payment will be about what your rent is, (maybe a little more) . If so, then buy something - because rent payments evaporate but mortgage payments are equity.
The other key thing is to buy something that's not going to drop in value by the time you want to sell it. Property value is primarily determined by the 3 factors location, location, and location. Thats it. If you can swing it, buy a shitty house in a nice neighborhood. You can always fix it up (within reason).
Other little rules - when markets go soft, multi-family units (condos) go soft first.
My condo is a trendy loft at the corner of 15th and Blake streets in Lower Downtown Denver (yes the Blake Street Bombers - *that* Blake street - 5 blocks away). Its doubled in price since I bought it 5 years ago and that location is so hot that it may soften a little but its never going down.
Next to go are the very outlying or half built new developments. Example was a lovely rural development near the Martin Marietta factory in west Denver (Roxborough). Absolutely gorgeous neighborhood - great views, built around a beautiful golf course with soaring red stones rising out of the rough. Defense cuts hit, Martin scaled back, and its just a little too far out for non-Martin employees to consider as a sane commute.
Established neighborhoods not on the decline are a great bet. Stuff close to the city is a great bet.
Stuff I don't trust is stuff like Marin County CA - with real estate prices that continue to rocket upwards despite a trashed local economy and the highest forclosure rate in the US. I guess you can't lose if you can make the payments but it still sort of defies logic to me.