What day of the week was July 4,1776? How can you create variables that represent the YEAR and MONTH for a given date? SAS software has a number of very useful date functions to answer these and other questions.The next two examples demonstrate representative situations.Suppose you have a SAS data set FUND which contains fund drive information. Included are variables DATE (date of donation, stored as a SAS date value) and AMOUNT (amount of donation).You would like charts showing donation AMOUNT by year and month. Here is the program:
You need only use the YEAR and MONTH functions to extract the appropriate information from DATE.The YEAR function returns a four-digit year; the MONTH function returns a number from 1 to 12.You might want to create a user-defined format for MONTH with 1='JAN', etc."PROC CHART," has more details on the CHART procedure.
Computing Date Intervals
The remaining examples in this chapter cover the INTCK and INTNX functions. These functions are used to compute the number of intervals between two dates and the date after which a given number of intervals has occurred, respectively. Interval units can be one of the following:DAY, WEEK,TENDAY, SEMIMONTH, MONTH, QUARTER (QTR), SEMIYEAR, or YEAR. There is also a WEEKDAY interval which allows you to count the number of working days, specifying which day(s) of the week will be days off. These functions can be quite complicated and SAS Technical Report P-222, a paper in the 1994 Northeast SAS Users Group Proceedings, by Alan Dickson entitled "Blind Dates & Other Lapses of Reason: Handling Dates in SAS." We demonstrate some elementary applications of these functions .
SAS Programming Related Tutorials
|SASS (Syntactically Awesome Style sheets) Tutorial||R Programming language Tutorial|
SAS Programming Related Interview Questions
|Logistics Interview Questions||SAS Programming,SQL server Interview Questions|
|Clinical SAS Interview Questions||SASS (Syntactically Awesome Style sheets) Interview Questions|
|SQL Server Analysis Services (SSAS) Interview Questions||R Programming language Interview Questions|
|SAS DI Interview Questions||Advanced SAS Interview Questions|
|Base Sas Interview Questions||SAS Macro Interview Questions|
|Clinical Data Management Interview Questions|
Sas Programming Tutorial
Input And Infile
Set, Merge, And Update
Table Lookup Tools
Proc Means And Proc Uimivariate
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.