Published on :
ETL CREATION_INTERNE

Date Processing and Display

This code is also available in: Deutsch Español Français
Awaiting validation
The script handles the creation of two temporary datasets. The first, 'userinfo', reads a date in `DATE9.` format ('20feb1960') and displays it in `DDMMYY10.` format. The second, 'julinedata', reads a date in Julian `JULIAN5.` format ('20047' representing the 47th day of the year 2000) and also displays it in `DDMMYY10.` format. Each dataset creation is followed by a `PROC PRINT` to visualize the results.
Data Analysis

Type : CREATION_INTERNE


All data used is created directly within the SAS script using `DATALINES` and `CARDS` instructions. There is no dependency on external data or pre-existing SAS libraries like SASHELP, nor on files to read. The data is purely demonstrative to illustrate date informats and formats.

1 Code Block
DATA STEP Data
Explanation :
This `DATA step` block creates the 'userinfo' dataset. It defines the `DOB` variable with the `DATE9.` informat for reading dates (e.g., '20feb1960') and the `DDMMYY10.` format for its display. Data is integrated via `datalines`.
Copied!
1DATA userinfo;
2informat DOB date9.;
3FORMAT DOB ddmmyy10.;
4INPUT DOB;
5DATALINES;
620feb1960
7;
8RUN;
2 Code Block
PROC PRINT
Explanation :
This `PROC PRINT` displays the content of the 'userinfo' dataset, allowing verification that the date has been correctly read and formatted according to previous specifications.
Copied!
1PROC PRINT DATA=userinfo;
2RUN;
3 Code Block
DATA STEP Data
Explanation :
This `DATA step` block creates the 'julinedata' dataset. It uses the `JULIAN5.` informat to read a date in Julian format (e.g., '20047', representing the 47th day of the year 2000) and applies the `DDMMYY10.` format for its display. Data is provided via `cards`.
Copied!
1DATA julinedata;
2informat DOB julian5.;
3FORMAT DOB ddmmyy10.;
4INPUT DOB;
5CARDS;
620047
7;
8RUN;
4 Code Block
PROC PRINT
Explanation :
This `PROC PRINT` displays the content of the 'julinedata' dataset, allowing confirmation of the correct reading and formatting of the Julian date.
Copied!
1PROC PRINT DATA=julinedata;
2RUN;
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.