I've got a dataset containing a date field named Submitted:
01Jan2015
01Jan2015
01Jan2015
02Jan2015
03Jan2015
I'm running a simple query builder which produces this code:
PROC SQL;
CREATE TABLE WORK.Stuff AS
SELECT DISTINCT t1.Submitted
FROM WORK.INPUTSET t1
ORDER BY t1.Submitted;
QUIT;
The output result is:
01Jan2015
01Jan2015
01Jan2015
02Jan2015
03Jan2015
Shouldn't there only be three records in the output file?
If your date field is a SAS date, it may contain a fractional part, try using
CREATE TABLE WORK.Stuff AS
SELECT DISTINCT round(t1.Submitted) as Submitted format=date9.
FROM WORK.INPUTSET t1
ORDER BY Submitted;
QUIT;
if your date field is a SAS datetime, it may contain a time value, try using
CREATE TABLE WORK.Stuff AS
SELECT DISTINCT datepart(t1.Submitted) as Submitted format=date9.
FROM WORK.INPUTSET t1
ORDER BY Submitted;
QUIT;
If your date field is a SAS date, it may contain a fractional part, try using
CREATE TABLE WORK.Stuff AS
SELECT DISTINCT round(t1.Submitted) as Submitted format=date9.
FROM WORK.INPUTSET t1
ORDER BY Submitted;
QUIT;
if your date field is a SAS datetime, it may contain a time value, try using
CREATE TABLE WORK.Stuff AS
SELECT DISTINCT datepart(t1.Submitted) as Submitted format=date9.
FROM WORK.INPUTSET t1
ORDER BY Submitted;
QUIT;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.