I have an excel file I imported into a SAS dataset. The problem is the excel file column names had spaces. Now the sas dataset columns have the spaces in them too. How do I reference these columns? Also how can I rename them? I tried using quotes in the example below, but got errors trying to run this code.
current dataset:
First Name Last Name
.... ....
.... ....
data test;
keep "First Name";
run;
the above code produces an error. it seems SAS doesn't like the quotes around the column name.
When you import the excel files into SAS, most invalid (in the sense of SAS, like space, $, -, etc ) characters were replaced with _ (under score). Your First Name in excel will become First_Name in SAS. You may be viewing the data file with Column Label. Change to Column Name in data viewer.
You could retain the same variable names with
options VALIDVARNAME=ANY ; (only in BASE and STAT)