BookmarkSubscribeRSS Feed
m_sd
Calcite | Level 5

Hello all,

 

I'm trying to import Qualtrics excel document and the raw data looks like this:

 

StartDate (variable name)
Start Date
{"ImportId":"startDate","timeZone":"America/Denver"}
5/12/2019 16:16

 

I deleted the observations that weren't relevant (rows 2 and 3) but the problem I'm running in to is that when I imported the excel sheet using the code below, I get output that looks like this "43597.6781712963" for a date and time value of "5/12/2019 16:16," for example.

DATA Work.dataset;
SET work.data;
IF Startdate = '{"ImportId":"startDate","timeZone":"America/Denver"}'
OR StartDate = 'Start Date' then DELETE;
RUN;

 

When I go to the OUTPUT DATA tab it shows that the StartDate variable is a character length of 52. Is there a way to change this so it reads it as a date and time like in the raw data file? Will deleting the 2nd and 3rd rows in the raw excel sheet solve my problem? 

 

Thank you!

 

P.S. I'm on SAS Studio v9.4, the free version for students.

1 REPLY 1
arthurcavila
Obsidian | Level 7

Did you try formatting the date as date?

Add a statement like:

FORMAT startdate date10.;

 

DATA Work.dataset;
  infile datalines;
  input startdate anydtdte16.;
  if startdate ~=.;

    numericdate = startdate;
  format startdate date10.;
  datalines;
  StartDate (variable name)
  Start Date
  {"ImportId":"startDate","timeZone":"America/Denver"}
  5/12/2019 16:16
  ;
RUN;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 560 views
  • 0 likes
  • 2 in conversation