Wanted Variable to be corrected Trap_Coll_Date;
---> 41503 is stored in excel, but it represents 8/17/2016
Some dates are stored as serial numbers, some dates are stored as regular dates
I can convert the serial numbers in excel into dates, but importing it to SAS reveals the original serial number from Excel. How to I fix this ?
Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.
Do you mean you are seeing values like 40123 in the spreadsheet that may represent 11/6/2009?
It may be as simple as setting the column to display as a date in Excel using the FORMAT Cells options.
Yes it appears like that, I've tried using the format options to convert the serial numbers to dates.
The problem is not all the dates were imputed into Excel as serial numbers. Some values appear as dates when formated options were changed from date to general.
This is the SAS output after importing the excel file
I'm not sure you can add the date format in PROC IMPORT.
So just add next code:
proc import ..... /* your code as is */
proc datasets lib=grad nolist;
format date date9.; /* or any other SAS date format */
I used the code you sent me, and sas Log stated this:
1320 proc datasets lib=grad nolist;
1321 modify mosdata;
ERROR: You are trying to use the numeric format DATE with the character variable trap_coll_date in
data set GRAD.MOSDATA.
1322 format Trap_Coll_Date date9.; /* or any other SAS date format */
is this because sas is reading dates as a character variabel instead of a numberic variable ?
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.