Data is statically generated in the code using date literals (e.g., '24NOV1996'd).
1 Code Block
DATA STEP Data
Explanation : Creation of the temporary table 'intervals'. Calculation of the number of time units (years, months, etc.) elapsed between the birth date and September 29, 2006, using INTCK.
Copied!
data intervals;
birthdate = '24NOV1996'd;
yrs = intck('year',birthdate,'29Sep2006'd);
months = intck('month',birthdate,'29Sep2006'd);
weeks = intck('week',birthdate,'29Sep2006'd);
qtrs = intck('qtr',birthdate,'29Sep2006'd);
put _all_;
run;
1
DATA intervals;
2
birthdate = '24NOV1996'd;
3
yrs = intck('year',birthdate,'29Sep2006'd);
4
months = intck('month',birthdate,'29Sep2006'd);
5
weeks = intck('week',birthdate,'29Sep2006'd);
6
qtrs = intck('qtr',birthdate,'29Sep2006'd);
7
put _all_;
8
RUN;
2 Code Block
DATA STEP Data
Explanation : Creation of the temporary table 'increment'. Calculation of the retirement date by adding 60 years to the birth date via INTNX, and application of the date9 format.
Copied!
data increment;
birthdt = '22oct91'd;
retirement = intnx('year',birthdt,60);
format birthdt retirement date9.;
run;
1
DATA increment;
2
birthdt = '22oct91'd;
3
retirement = intnx('year',birthdt,60);
4
FORMAT birthdt retirement date9.;
5
RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.