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!
Data userinfo;
informat DOB date9.;
format DOB ddmmyy10.;
input DOB;
datalines;
20feb1960
;
run;
1
DATA userinfo;
2
informat DOB date9.;
3
FORMAT DOB ddmmyy10.;
4
INPUT DOB;
5
DATALINES;
6
20feb1960
7
;
8
RUN;
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!
proc print data=userinfo;
run;
1
PROC PRINTDATA=userinfo;
2
RUN;
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!
data julinedata;
informat DOB julian5.;
format DOB ddmmyy10.;
input DOB;
cards;
20047
;
run;
1
DATA julinedata;
2
informat DOB julian5.;
3
FORMAT DOB ddmmyy10.;
4
INPUT DOB;
5
CARDS;
6
20047
7
;
8
RUN;
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!
proc print data=julinedata;
run;
1
PROC PRINTDATA=julinedata;
2
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.