The short answer is no.....however, it depends on the wording of the contract you have with your roomate/mastertenant.
Most landlords have a clause either prohibiting assignment or subletting or limiting it under special circumstances.
Landlords will serve a notice 6.14 to allow any rent increases to avoid further rent control on revolving tenancies from subleeasees.
Roommates/mastertenants will serve a different notice called 6.15 to allow them to kick you you or evict without cause thus avoiding the eviction control under SF Law imposed on all SF landlords.
A lot depends on whether these notices were served correctly and timely and on each and every situation (there are a lot of different situations).
As most everyone knows, Realtors are not attorneys and cannot give legal advice.
Realtors, with property management experience (like myself), can only give practical advice without making interpretations of the law.
I feel that it's important that any transaction dealing with the complicated and Voluminous Rent Ordinance (SF Admin Law 37.9) should be handled with an experienced individual.
Peter T. Chin Realtor #01866332