- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 10-16-2008 07:57 AM
(1813 views)
Hi,
I am very new to SAS
I want to get the number of transactions that happened in a particular hour of the day. I have a log database which has transaction details and time occurred. I run a frequency on the Hour to get number of transactions happened in an hour. If there is no txns happen in a particular hour I want it to be displayed as frequency 0. Is there any way customize PROC FREQ for this.
Thanks in advance
I am very new to SAS
I want to get the number of transactions that happened in a particular hour of the day. I have a log database which has transaction details and time occurred. I run a frequency on the Hour to get number of transactions happened in an hour. If there is no txns happen in a particular hour I want it to be displayed as frequency 0. Is there any way customize PROC FREQ for this.
Thanks in advance
6 REPLIES 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
One way is to modify your table of transactions before your run PROC FREQ so that every hour of the day is represented by a dummy transaction, and there is a weight variable which takes on a value of 0 for those dummy transactions. Real transactions have a weight of 1.
Then in PROC FREQ, use the WEIGHT weightvar /ZEROS; command
Then in PROC FREQ, use the WEIGHT weightvar /ZEROS; command
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
try PROC MEANS, which has at least two options that meet what you seek. Copied from the online-doc :
COMPLETETYPES
Create all possible combinations of class variable values
CLASSDATA=
Specify a secondary data set that contains the combinations of class variables to analyze
In that secondary data set you would place the time points at which you want summary.
Perhaps you should follow the examples
http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a000357025.htm
Another way to make PROC MEANS do what you need might be to use the "PRELOADFMT" feature described in the doccumentation and demonstrated at the example http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a000353486.htm
just remember to use a format for the datetime value that gives you the hour of the day ( even if you have to create it ~~> with PROC FORMAT 😉
all good solutions
good luck
PeterC
COMPLETETYPES
Create all possible combinations of class variable values
CLASSDATA=
Specify a secondary data set that contains the combinations of class variables to analyze
In that secondary data set you would place the time points at which you want summary.
Perhaps you should follow the examples
http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a000357025.htm
Another way to make PROC MEANS do what you need might be to use the "PRELOADFMT" feature described in the doccumentation and demonstrated at the example http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a000353486.htm
just remember to use a format for the datetime value that gives you the hour of the day ( even if you have to create it ~~> with PROC FORMAT 😉
all good solutions
good luck
PeterC
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hey..
Both the solutions worked .. Thank you very much
Both the solutions worked .. Thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In PROC FREQ how to remove the proc titles
The FREQ Procedure &
Table of X by Y.
I searched for it and sow that NOHEADER or NOTITLE will do that. I am using SAS 9 on Z/OS .. I tried giving options=notitle;. but its giving some error. Can any one help. Again I am very new to SAS.
Regards
Arun
In PROC FREQ how to remove the proc titles
The FREQ Procedure &
Table of X by Y.
I searched for it and sow that NOHEADER or NOTITLE will do that. I am using SAS 9 on Z/OS .. I tried giving options=notitle;. but its giving some error. Can any one help. Again I am very new to SAS.
Regards
Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
The procedure title "The FREQ Procedure" can be removed with the statement:
[pre]ods noptitle;[/pre]
This is a global statement and will turn off ALL procedure titles until you turn it back on in this session or start a new SAS session. to turn procedure titles back on:
[pre]ods ptitle;[/pre]
cynthia
The procedure title "The FREQ Procedure" can be removed with the statement:
[pre]ods noptitle;[/pre]
This is a global statement and will turn off ALL procedure titles until you turn it back on in this session or start a new SAS session. to turn procedure titles back on:
[pre]ods ptitle;[/pre]
cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Cynthia,
This wont remove the title Table of X by Y right?. I read in some website that there is an option NOTITLE to remove both the titles and its not working for me. Also I read that this option was available from sas 8.2 onwards and they removed it from SAS 9 onwards. Any body have any idea on this?
Regards
Arun
This wont remove the title Table of X by Y right?. I read in some website that there is an option NOTITLE to remove both the titles and its not working for me. Also I read that this option was available from sas 8.2 onwards and they removed it from SAS 9 onwards. Any body have any idea on this?
Regards
Arun