Hello everybody.
I have variables which its attributs are showed below:
TRD_EVENT_DT | Num | 8 | DATE9. | DATE9. | TRD_EVENT_DT |
TRD_EVENT_MS | Char | 1 | $1. | $1. | TRD_EVENT_MS |
TRD_EVENT_TM | Char | 8 | $8. | $8. | TRD_EVENT_TM |
TRD_INSTR_NAME | Char | 9 | $9. | $9. | TRD_INSTR_NAME |
TRD_PR | Char | 5 | $5. | $5. | TRD_PR |
TRD_STCK_CD | Char | 5 | $5. | $5. | TRD_STCK_CD |
TRD_STCK_GRP_ID_CD | Char | 2 | $2. | $2. | TRD_STCK_GRP_ID_CD |
TRD_STCK_ID | Char | 12 | $12. | $12. | TRD_STCK_ID |
TRD_TRA_NR | Char | 10 | $10. | $10. | TRD_TRA_NR |
TRD_TUROVR | Char | 9 | $9. | $9. | TRD_TUROVR |
Explanation of variables of some columns:
[TRD_EVENT_DT] Month / Day / Year
,[TRD_EVENT_TM] Time: hh:mm:ss
,[TRD_PR] Stock Price
,[TRD_TUROVR] Turnover.
I want to create filter on the data source in a specific time range. The time variable is between 9:00 till ~16:00. However, I just want to limit data set between 9:00 till 12:00.
How can I do that?
Thanks in advance.
Since your time variable is shown as char8, I'd try:
data want; set have; if '09:00't le input(TRD_EVENT_TM,time8.) le '12:00't; run;
Art, CEO, AnalystFinder.com
Since your time variable is shown as char8, I'd try:
data want; set have; if '09:00't le input(TRD_EVENT_TM,time8.) le '12:00't; run;
Art, CEO, AnalystFinder.com
Why haven't you changed the type/format to a date/datetime rather than character?
A lot of your questions could be answered very simply if you specified them as time/date/datetime variables.
where hour(time_variable) between 9 and 12;
http://support.sas.com/resources/papers/proceedings10/134-2010.pdf
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: