BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
6 REPLIES 6
Paige
Quartz | Level 8
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
Peter_C
Rhodochrosite | Level 12
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
deleted_user
Not applicable
Hey..

Both the solutions worked .. Thank you very much
deleted_user
Not applicable
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
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
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

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1380 views
  • 0 likes
  • 4 in conversation