 (1) 
Note the structure on the RHS: 10 is a pure number, while yd is a unit of measurement. L is not equal to 10, and L is not equal to yd; rather, L is equal to the product, 10·yd.
 (2) 
Therefore we can write:
 (3) 
Equation 3 comes from equation 2 by direct application of the axioms of algebra, namely the definition of division, and the definition of equality.
The axioms also say we can multiply the RHS of equation 1 by unity. This gives us:
which simplifies to
 (5) 
which is true and useful.
The technique of writing equations to express the relationships between units is used even in nonscientific settings such as cooking; see e.g. reference 1. This is the smart way to do it. (There are plenty of dumber ways, but let’s not get into that.)
The tactic of multiplying by unity is heavily used in science and engineering at all levels, from highschool chemistry on up. It even has a name: The Factor Label method.
In my experience, this is the #1 best response to those who claim they have never had occasion to apply anything they learned about algebra.
In simple cases, the Factor Label method can be carried out mechanically, even by people who have no clue about algebra. However, in more complicated cases – involving (say) square feet and cubic yards – it helps to know the axioms of algebra. In all cases, if you want to understand what’s going on, algebra helps a lot.
 (6) 
This inelegant tactic is useful if you are using a calculator that can multiply pure numbers but is too stupid to keep track of the units. Such situations are becoming rare; any computer worthy of the name can run a computer algebra system such as Macsyma that can easily keep track of units, directly using equations such as L=10yd.
In any case, it must be emphasized that the LHS of equation 6 is not «L feet», and the RHS is not «L yards». The units belong in the denominator, because we are stripping the units out of L by dividing them out.
It must also be emphasized that carrying around a pure number, stripped of its units, is bad practice. You run the risk of forgetting which units go with which number. Sometimes the penalty for getting this wrong is on the order of three hundred million dollars, as in the case of the Mars Climate Orbiter (reference 2 and reference 3).
There is a right way and a wrong way to express the units associated with a given quantity.
Some simple yet useful examples include:
To a good approximation you can make a yardstick by gluing three onefoot rulers together endtoend, as shown in figure 2. This gives us a concrete, physical basis for saying that 1 yard “equals” three feet.
This physical interpretation is captured in the algebra, if we do things right. For example, if we multiply two quantities together, the numerical magnitudes get multiplied and the units get multiplied. For example, if the length L is 30 feet and the width W is 2 feet, the area A is given by:
 (7) 
It would be quite improper to say «the area was 60», or that «the area was 60 feet». The area is 60 square feet.
Here is an example of what not to do. This is taken from page 13 of reference 4.

In this document, we put equations and tables on a red background to warn you about things that are not recommended. Similarly we sometimes use «⋯» as scarequotes around improper expressions.
This equation uses the unit of measurement (C or F) as a standin for the thing being measured. This is a Bad Idea. It is diametrically inconsistent with modern notions of unitanalysis.
There is a very important difference between the thing being measured and the unit used to measure it, as discussed in section 3.2.
Here’s another example: Recently I was looking at the data plate on an electric motor. It said:

The colons on the data plate were meant to be interpreted as equal signs.
If you find this confusing, good for you. This usage is considered perverse, as indicated by the red background. This usage is exactly backwards relative to how it should be done. However, you still see it from time to time, so it is worth learning to recognize it. Here’s how it should have been done:
rated power  =  1 HP  type  =  capacitorstart  
rotation rate  =  1725 RPM  service factor  =  1.0  
max current  =  12.3 A  arrangement  =  1 phase  
voltage  =  115 V  powerline frequency  =  60 Hz 
If you are going to use the proper system you must strictly avoid mixing it with the perverse system. This leaves us with the question, what to do if you encounter something expressed the bad way, such as the motor data plate mentioned above.
The simplest answer is to recognize that the RPM mentioned on the data plate belongs on the RHS of the equation. Another option is to say that the RPM belongs in the denominator on the LHS; this is inelegant but not wrong:
rated power / HP  =  1  Type  =  capacitorstart  
rotation rate / RPM  =  1725  service factor  =  1.0  
max current / A  =  12.3  arrangement / phase  =  1  
voltage / V  =  115  powerline frequency / Hz  =  60 
Note: Whenever you see the words “measured in” you can replace them by “divided by”. This is a trustworthy rule for translating word problems into equations. (It is analogous to the rule that says in expressions like “one tenth of thirty” the “of” gets replaced by “multiplied by”.)
Here’s a trickier example of bad practice, from page 190 of reference 4. For a steam engine:

I wish to make two different points about this. Please let’s not confuse the two points.
The thing that is really interesting here is that the way units are used on the LHS of equation 9 is inconsistent with the way units are used on the RHS, and in particular with the way the quantities P, L, A, and N are defined on the RHS of equation 10.
This is relevant because if the people who use backwards units would use them consistently backwards, we might chalk it up to a difference of taste, not worth arguing about. But when they are inconsistent about it, it’s more than a question of taste; it’s an outandout blunder.
The best way to remove the inconsistency is to standardize on the modern approach.

which is interesting because in some sense those four statements are dimensionally correct, if we consider P, L, A, and N to be “pure numbers” (unitless and dimensionless) standing in front of explicit units.
This is, however, still not recommended. Even though it is not wrong in any deep sense, it is not recommended. The problem is that the numerical value of (say) A is tied to the units in use.
In contrast, modern practice is to do algebra using variables that have not had units factored out, so that the areavariable expresses the concept of area, no matter what units are used. For example:
 (11) 
At this point you may be wondering about an interesting issue:
So you could argue that a formula involving pure numbers has some value, when you are using notsofancy electronic aids.
That is a valid argument, but there is a stronger counterargument. The computer’s need for pure numbers can be accommodated within the formalism of modern unit analysis. One could write:
indicated power/HP = 
 (12) 
(where spm means power strokes per minute).
which has the advantage of being absolutely true no matter what units the variables are measured in. If L is measured in (say) meters instead of feet, then the problem is obvious: You will wind up with a factor of (m/ft) left over. More importantly the solution is obvious if you follow the factorlabel method, because 1 (m/ft) is a number with a wellknown value.
Units are not the same as dimensions. A foot and a yard have the same dimensions, namely dimensions of length. But a foot and a yard are very different units; one is smaller than the other by a factor of three. Length and width have the same dimensions. Sometimes length and width are measured in the same units, and sometimes in different units. The distinction between units and dimensions comes into sharp focus when we consider dimensionless units, as in reference 5.
See reference 6 for an introduction to dimensional analysis. All notions of units and dimensions rest on deeper notions of scaling, as discussed in reference 7.
There is a profound difference between the unit of measurement and the thing being measured. For example, if you are measuring a piece of fabric with a yardstick, the fabric is not to be confused with the yardstick. The fabric is the thing being measured, and the yardstick embodies the unit of measurement.
Another example can be found in equation 8. Temperature is the thing being measured; degrees C or degrees F are the units of measurement.
Yet another example is the rotation rate in table 2. The rate is the thing being measured, and RPM is the unit of measurement. Just as the rulers in figure 2 have physical significance, the RPM has physical significance. If the rate changes from 1725 RPM to 1730 RPM, the RPM is not what changes; the rate is what changes. It makes absolutely no sense to write RPM = 1725. Writing such a thing is supersloppy.
Sometimes, the thing being measured is named after a unit. Examples include
It must be emphasized that the physical quantity is not required to be measured in the named units.
Note that mileage (as a measure of fuel economy) is exceptional because it measures distance per unit volume, even though the name would suggest plain distance.