Confounding is one of the major types of bias encountered in observational epidemiologic surveys designed to study the relation between an exposure factor and a health event. A common way to remove confounding bias during the statistical analysis phase is to adjust for the confounders in a regression model. If a confounding factor is assessed as a continuous variable, it is necessary to define how the variable is entered into the regression model. In the case of logistic regression, we illustrate through simulation that coding by a binary variable or a categorical variable with broad categories may lead to substantial residual confounding. Specific approaches can be used to define a coding method that limits residual confounding. Among these, we briefly present nonparametric approaches and describe in detail several semiparametric approaches (generalised partial linear models, spline regression and fractional polynomials). These can be used to estimate the relation between a continuous factor and the health event of interest by a smooth non pre-specified function. In semiparametric models, the effect of certain covariates is coded by a parametric function, whereas the coding of one or two continuous variables is represented by a nonparametric function. These models can be used in exploratory analyses to describe dose-effect relations between the confounder and the health event, and thus help to define a relevant coding for the confounder.