Hi -
I imported a file into SAS and some columns were converted into number format while others into text? why is that? how do i ensure that columns are imported the way I wanted? is there a way?
Im using PROC SQL..
one of my columns that is in a TEXT format is a date 15JUL2016:00:00:00
I want to change it to a date9 format but its not letting me because its in text so I tried to do input(act_date,12.0) but when i opened the new table that column was ALL blank so the input did not work?
How do i convert it to a number so i can do the date9 after? Thank you very much!
Input(a.date, datetime20.)
Your INPUT requires the correct informat which would be a date time format, not 12.
Try datetime20.
I'm assuming you used proc import to import your data? If so, it guesses what type/format should be, obviously not correctly always.
If you have a text file you can customize your import using a data step so it's read in correctly. Unfortunately Excel doesn't play well with others and there isn't an easy way to specify types when importing from an Excel file. You can look into DBSASTYPE if you'd like to explore that route.
where would i put the datetime20.. what would be the query?
I import manually.. so i go to file -> Import data -> etc.
right now i just have
proc sql;
create table test1.discovery
select
A.field,
A. region
input(A.date1,12.0) as
from test1.location
;
i tried this before but didnt work...
datepart(input(A.date1,12.0))
Input(a.date, datetime20.)
Here are some examples that should help. (ANYDTDTM)
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: