turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- creation and identification of time windows

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-26-2015 02:02 PM

Hello, i have a data, and for every day i want to create time Moving window, and then to process all windows. at the end, i will keep only one row for big window and there will be some statistics of every little windows.

moving window includes two big windows(every one is 30 minutes, of course it can be any number) and every one of them include 3 little windows(every one can be different number but total is 30 minutes)

for example my window is 1 hour, so one window is my sample window is 30 minutes, and then the second window (predicted window) is too 30 minutes. for every window i have to know their id(i have to create id)

what i get :

window : 08:00 - 09:00

sample window : 08:00-08:30

sample_window1 :08:00-08:05, sample_window2 : 08:05-08:15, sample_window3 : 08:5-08:30

predicted window : 08:30-09:00

predicted_window1 :08:30-08:40, predicted_window2 : 08:40-08:50, predicted_window3 : 08:50-09:00

then i have to create interval, for example 10 minutes, and create windows again and so on...

window : 08:10 - 09:10

sample window : 08:10-08:40

sample_window1 :08:10-08:15, sample_window2 : 08:15-08:25, sample_window3 : 08:25-08:40

predicted window : 08:40-09:10

predicted_window1 :08:40-08:50, predicted_window2 : 08:50-09:00, predicted_window3 : 09:00-09:10

off course all times and intervals are macro variables.

my data example :

time date

08:00 26/10/15

08:01 26/10/15

08:10 26/10/15

08:15 26/10/15

08:20 26/10/15

08:29 26/10/15

08:37 26/10/15

08:38 26/10/15

08:47 26/10/15

08:54 26/10/15

08:58 26/10/15

.....

How can i do it? thank you!!!!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-26-2015 03:15 PM

Do you have SAS/ETS? What statistics are you creating?

Depending on the statistics it may be better to use PROC EXPAND rather than to try and create your windows manually.

Depending on the statistics it may be better to use PROC EXPAND rather than to try and create your windows manually.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-27-2015 01:25 AM

yes, i have ETS. i know about the proc expand, but how i can create in proc expand moving window?

i predicted windows i want only to find the last price and first price, and in the sample window, i want to find some simple statistics, such as mean, total volume... then i want to present it as one row, i.e every big window(in my example 1 hour) .

thank you for your help

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-27-2015 11:25 AM

Not sure about your final dataset, but the CONVERT statement supports a lot of moving windows.

All of the transformations available,

http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_expand_sect026...

And an example. Here the last one is a moving average and you can specify the window, ie your 30 minutes.

http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_expand_sect034...

All of the transformations available,

http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_expand_sect026...

And an example. Here the last one is a moving average and you can specify the window, ie your 30 minutes.

http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_expand_sect034...