weight to Sample

How can a survey sample be weighted (by 4 demographic variables) so that it is a representative sample of the population? (As can be done in software)