Hi, I uploaded a CSV file to SAS Studio, but this file has a column name with blank between two words. It causes problems when writing code referring to this variable. Is there a way to rename the variable to remove the blank so that I can refer to this column in my code? Thnak you!
There are at least three ways of dealing with this:
data want;
set have;
rename 'My Column with blanks'n = My_Column_without_blanks;
run;
There are at least three ways of dealing with this:
data want;
set have;
rename 'My Column with blanks'n = My_Column_without_blanks;
run;
Don't use proc import, write a data step reading the file.
Don't use PROC IMPORT, write the DATA step yourself. IMPORT is not needed for text files and causes unnecessary problems. See thousands of posts here.
As a stopgap measure, set
options validvarname=v7;
before PROC IMPORT.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.