@SM8 wrote:
Hello,
So I have two variables in my dataset, pounds and Ounces. I am trying to combine these variables into a total weight variable.
For example, if an observation has a recorded 8 pounds and a recorded 2 ounces, I want to create this new variable to say 8.2. Is this possible in SAS, and if so, how do I accomplish this?
Be very careful of that sort of non-standard representation. If you want a decimal version you would be better off where 2 ounces is represented as 0.125 then you actually have unit for the variable in pounds:
data want;
set have;
newweight = pounds + ounces/16;
run;
Would be the way with a data step to convert ounces to pounds.
You would have to very clearly describe the actual advantage or use of storing the value as 8.2. You couldn't do substraction, such as determining change in weight, or look up with standard tables a value as you propose.
Or perhaps change the whole value to ounces? Newweight = pounds*16 + ounces;
I dealt with some data that was provided in a form similar to what you propose only the "decimal" portion was fourths of a pound. And none of the uses wanted that sort of units so had to be converted to actual pounds before anything could be done.