0

I want to make permanent changes is the variable name Fclass and label Date as Departure date. i have used the modify statement along with rename but I am getting error when I am running the program.

proc datasets library= ia;
modify passngrs;
rename FClass= First Class;
label Date='Departure date';
format Date date9.;
run;
  • 1
    "rename FClass= First Class;" -> "First Class" does not look like a valid SAS column name. – Egor Lipchinskiy May 18 '22 at 08:57
  • Why are you just assigning a label to DATE but trying to rename FCLASS? The easiest fix is to remove the space from the new name. `rename fclass=FirstClass;` – Tom May 18 '22 at 14:46

1 Answers1

1

You might want to do any of these:

  • Rename to a variable name that does not contain a space
    rename FCLASS = FirstClass;
  • Rename to a trickier name by using session options and a name literal
    options validvarname=any; proc ...; ...; rename FCLASS = 'First Class'N;
  • Use a label for FCLASS instead of renaming it
    label FCLASS = 'First Class';
Richard
  • 25,390
  • 3
  • 25
  • 38