proc sgplot data=anl317.uscrime;
vbox victim age;
run;
the code above results in an error labelled:
If there is a space in a variable name, you can try using a name literal:
proc sgplot data=anl317.uscrime;
vbox "Victim Age"n;
run;
It's a hassle, sometimes it is easier to rename the variable to remove the space, e.g.:
data uscrime;
set anl317.uscrime (rename=("Victim Age"n=VictimAge));
run;
proc sgplot data=uscrime;
vbox VictimAge;
run;
Run a proc contents on the data set and confirm the variable name. Victim may be the label, not the variable name.
proc contents data=anl317.uscrime;
run;
@MengWei wrote:
proc sgplot data=anl317.uscrime; vbox victim age; run;
the code above results in an error labelled:
ERROR: Variable VICTIM not found.anyone have any idea what I can change to my code for it to work?I have tried "Victim Age", Victim Age, victimage, all does not work.
Victim Age is the variable name though, it does not work.
If there is a space in a variable name, you can try using a name literal:
proc sgplot data=anl317.uscrime;
vbox "Victim Age"n;
run;
It's a hassle, sometimes it is easier to rename the variable to remove the space, e.g.:
data uscrime;
set anl317.uscrime (rename=("Victim Age"n=VictimAge));
run;
proc sgplot data=uscrime;
vbox VictimAge;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.