01-10-2014 03:15 PM
I have a dataset sorted by three variables, and I'm trying to copy another variable from the previous observation within each grouping conditional on whether the variable has a value or not. So far, here's the code that I have:
length V1 8;
By PlantID PMStd Fuel;
if first.Fuel then V1 = .;
if HeatRate ^=. then V1 = HeatRate;
HeatRate = V1;
When I run this code, I get the following error:
"ERROR: Variable V1 has been defined as both character and numeric."
I don't know why this would happen, since I'm defining the variable V1 as a numerical variable in the first statement of the data step. The variable V1 doesn't exist prior to this data step. I've run this same code with a character variable (after defining V1 as $5), and it works perfectly. Thanks in advance for any help you can provide.
01-10-2014 03:21 PM
What variable type is HeatRate? Your missing a period after the eight in the length statement, not sure if thats an issue as well.
Can you post proc contents results on FuelCost11?
Need further help from the community? Please ask a new question.