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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.