A sewing machine forms a seam in the form of a series of stitches for a length preset by the operator. The length of the seam formed is computed from feed pitches data each generated when one stitch is formed. The operation of the sewing machine is stopped when the computed seam length coincides with the preset seam length.