BookmarkSubscribeRSS Feed
jamesbe
Calcite | Level 5

SaS Gurus,

I work in a mineral processing facility and I'm experimenting around with SaS Enterprise Miner to see if I can determine which sensor states and sequences lead to certain types of alarms.

I'm really after some advice as to the best preparation for the data. As a starting point, can I analyse it in its current form (see below), or do I need to convert it into timeseries data every 100 ms.

The data is stored from our sensors only when the value changes. It is stored in the following timestamped format: <Date Time>, <Variable Name>, <Variable Value>. Example Below.

TimeStamp

VariableValue
3/02/2014 16:02:34.1Position22.34
3/02/2014 16:02:34.3Position22.37
3/02/2014 16:03:32.7Speed83
3/02/2014 16:04:01.6Position22.39
3/02/2014 16:04:03.2Speed77
3/02/2014 16:07:29.0Position22.48

While the alarm instances are just identified by the occurrence timestamp.

TimeStampAlarm
3/02/2014 16:03:23.0Alarm 1
3/02/2014 18:01:02.0Alarm 1

Any advice would be greatly appreciated.

James

Perth, Australia

1 REPLY 1
Tom
Super User Tom
Super User

Convert your measurement readings from time points to intervals.  Then you can merge the alarm times with the intervals.

I changed the time of the second alarm (and the label) so that it would match a SPEED value.

data alarms ;

  infile cards dsd dlm='|' truncover ;

  informat timestamp anydtdtm. ;

  format timestamp datetime24.2;

  length alarm $20;

  input timestamp alarm;

cards;

3/02/2014 16:03:23.0|Alarm 1

3/02/2014 18:01:02.0|Alarm 2

run;

data values ;

  infile cards dsd dlm='|' truncover ;

  informat timestamp anydtdtm. ;

  format timestamp datetime24.2;

  length position $20;

  input timestamp position value;

cards;

3/02/2014 16:02:34.1|Position|22.34

3/02/2014 16:02:34.3|Position|22.37

3/02/2014 16:03:02.7|Speed|83

3/02/2014 16:04:01.6|Position|22.39

3/02/2014 16:04:03.2|Speed|77

3/02/2014 16:07:29.0|Position|22.48

run;

proc sort ;

  by position descending timestamp ;

run;

data ranges ;

  set values ;

  by position descending timestamp ;

  start=timestamp;

  end = lag(timestamp);

  if first.position then end = .;

  format start end datetime24.2;

  keep position value start end

run;

proc sql ;

   create table want as

   select a.alarm,a.timestamp as alarm_time, b.*

   from alarms a left join ranges b

   on a.timestamp >= b.start and (a.timestamp < b.end or b.end is null)

   order by 1,2

;

quit;

proc print;

run;


Alarm 1|02MAR2014:16:03:23.00|Position|22.37|02MAR2014:16:02:34.30|02MAR2014:16:04:01.60

Alarm 1|02MAR2014:16:03:23.00|Speed|83|02MAR2014:16:03:02.70|02MAR2014:16:04:03.20

Alarm 2|02MAR2014:18:01:02.00|Position|22.48|02MAR2014:16:07:29.00|

Alarm 2|02MAR2014:18:01:02.00|Speed|77|02MAR2014:16:04:03.20|

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

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