I did not quite understand the example related to the question. But you can loop through the sequence (1 to 100) and one by traversing the directions (top, right, bottom and left) and creating classes for each of the situations.
Ex.
SASS:
$_DIRECTIONS: (top right bottom left)
@for $i from 1 through 100
.margin-#{$i}
margin: #{$i}px
@each $direction in $_DIRECTIONS
.margin-#{$direction}-#{$i}
margin-#{$direction}: #{$i}px
SCSS:
$_DIRECTIONS: (top right bottom left);
@for $i from 1 through 100 {
.margin-#{$i} { margin: #{$i}px; }
@each $direction in $_DIRECTIONS {
.margin-#{$direction}-#{$i} { margin-#{$direction}: #{$i}px; }
}
}
HTML:
<div class="container margin-top-12 margin-left-15 margin-bottom-88"></div>