I think it's simpler to do all in the SQL step.
proc sql noprint ;
select case type when "char"
then "input("||name||",32.) as "
else ""
end
||
name
into :renames separated by ","
from dictionary.columns
where libname="WORK" and memname="HAVE"
;
create table want as select &renames from have ;
quit;
But you still create a new variable in this case.
To OP :
If you are using EG, then in EG's wizard of importing data, there is a function you can change the type of variables when you import data.
Ksharp
Please examine proc contents for the input table.
What columns are alpha where you expect to be numeric? Examine those columns to see if you have some kind of data error. For example, a single value of 'unknown date' in the excel spreadsheet would cause that column to be read as character and not datetime.
If I was in your position, I would think of a very simple macro in Excel.
Select the Range Cell( A,B) - Cell (X,Y) - Fromat them as Number if store as Text.
Simple the job gets done in mater of minutes.
You can also convert the headers to DATE format in Excel Macro - select the right rigne is what matters.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.