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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: