zakito
zakito

Reputation: 1

sas time format dates

I want to analyze a time series data in SAS. I have a data set in excel that I'm importing into SAS University Edition, which is very easy to do. The time variable is 5-minute increments from 6:00 to 8:55 for each day of the week.

When I ran timeseries, I get the error: “ERROR: The data set WORK.DATA is not sorted by the ID variable. At observation number 37, time=6:00:00, but time=8:55:00 for the previous observation.”.

My understanding is that the TIME variable is not unique to each observation. My question is how to make the time variable unique for all cases.

The link to the data is below if someone wants to play with it: https://drive.google.com/file/d/18SY7stsXS0CztWda2KavZXCwaMQA5yzG/view?usp=sharing

Upvotes: 0

Views: 113

Answers (1)

momo1644
momo1644

Reputation: 1804

You need to convert you time to datetime so that each row is unique, hence the datetime will be your ID and sort by ID.

In your data, your date is just the day of the week (ex. Mon). You can either:

  • Add the Date, then concatenate date and time to get the datetime; you can use the sas DHMS() function for this,
  • Add the Datetime directly in your data.

Upvotes: 0

Related Questions