Repository navigation
Expand file tree
/
Copy pathSAS_dates.html
More file actions
343 lines (323 loc) · 12.3 KB
/
Copy pathSAS_dates.html
File metadata and controls
343 lines (323 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SAS Date/Time Formats Reference Chart</title>
<style>
/* General styling */
body {
font-family: Arial, Helvetica, sans-serif;
line-height: 1.6;
color: #333;
max-width: 1100px;
margin: 0 auto;
padding: 20px;
}
h1 {
color: #2c3e50;
text-align: center;
padding-bottom: 10px;
border-bottom: 2px solid #3498db;
margin-bottom: 30px;
}
h2 {
color: #2980b9;
margin-top: 30px;
padding-bottom: 5px;
border-bottom: 1px solid #ddd;
}
/* Table styling */
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 30px;
page-break-inside: avoid;
}
th {
background-color: #f2f2f2;
color: #333;
font-weight: bold;
text-align: left;
padding: 10px;
border: 1px solid #ddd;
}
td {
padding: 8px 10px;
border: 1px solid #ddd;
vertical-align: top;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
/* Print-specific styling */
@media print {
body {
padding: 0;
font-size: 12pt;
}
h1 {
font-size: 18pt;
margin-bottom: 20px;
}
h2 {
font-size: 14pt;
margin-top: 20px;
page-break-after: avoid;
}
table {
font-size: 10pt;
}
.pagebreak {
page-break-before: always;
}
@page {
margin: 0.5in;
}
.no-print {
display: none;
}
}
/* Notes section */
.notes {
background-color: #f8f9fa;
padding: 15px;
border-left: 4px solid #3498db;
margin: 20px 0;
}
.notes h3 {
margin-top: 0;
color: #2c3e50;
}
</style>
</head>
<body>
<h1>SAS Date/Time Formats Reference Chart</h1>
<h2>Date Formats</h2>
<table>
<thead>
<tr>
<th>Format</th>
<th>Description</th>
<th>Example</th>
<th>Output</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>DATEw.</code></td>
<td>Writes date values in the form ddMMMyy or ddMMMyyyy</td>
<td><code>DATE9.</code> with value 22734</td>
<td><code>15MAR2022</code></td>
</tr>
<tr>
<td><code>DDMMYYw.</code></td>
<td>Writes date values in the form dd/mm/yy or dd/mm/yyyy</td>
<td><code>DDMMYY10.</code> with value 22734</td>
<td><code>15/03/2022</code></td>
</tr>
<tr>
<td><code>DDMMYYBw.</code></td>
<td>DD-MM-YY format with blank separator</td>
<td><code>DDMMYYB10.</code> with value 22734</td>
<td><code>15 03 2022</code></td>
</tr>
<tr>
<td><code>DDMMYYCw.</code></td>
<td>DD:MM:YY format with colon separator</td>
<td><code>DDMMYYC10.</code> with value 22734</td>
<td><code>15:03:2022</code></td>
</tr>
<tr>
<td><code>DDMMYYDw.</code></td>
<td>DD.MM.YY format with period separator</td>
<td><code>DDMMDYD10.</code> with value 22734</td>
<td><code>15.03.2022</code></td>
</tr>
<tr>
<td><code>DDMMYYPw.</code></td>
<td>DD.MM.YY format with period separator (p)</td>
<td><code>DDMMYYP10.</code> with value 22734</td>
<td><code>15.03.2022</code></td>
</tr>
<tr>
<td><code>JULIANw.</code></td>
<td>Writes date values as Julian dates in the form yyddd or yyyyddd</td>
<td><code>JULIAN7.</code> with value 22734</td>
<td><code>2022074</code></td>
</tr>
<tr>
<td><code>MMDDYYw.</code></td>
<td>Writes date values in the form mm/dd/yy or mm/dd/yyyy</td>
<td><code>MMDDYY10.</code> with value 22734</td>
<td><code>03/15/2022</code></td>
</tr>
<tr>
<td><code>MONYYw.</code></td>
<td>Writes date values in the form mmmyy or mmmyyyy</td>
<td><code>MONYY7.</code> with value 22734</td>
<td><code>MAR2022</code></td>
</tr>
<tr>
<td><code>NLDATEw.</code></td>
<td>Writes date values in the form based on the locale</td>
<td><code>NLDATE10.</code> with value 22734</td>
<td>Depends on locale</td>
</tr>
<tr>
<td><code>WEEKDATEw.</code></td>
<td>Writes date values in the form day-of-week, month-name dd, yyyy</td>
<td><code>WEEKDATE28.</code> with value 22734</td>
<td><code>Tuesday, March 15, 2022</code></td>
</tr>
<tr>
<td><code>WORDDATEw.</code></td>
<td>Writes date values in the form month-name dd, yyyy</td>
<td><code>WORDDATE18.</code> with value 22734</td>
<td><code>March 15, 2022</code></td>
</tr>
<tr>
<td><code>YYMMDDw.</code></td>
<td>Writes date values in the form yy/mm/dd or yyyy/mm/dd</td>
<td><code>YYMMDD10.</code> with value 22734</td>
<td><code>2022/03/15</code></td>
</tr>
<tr>
<td><code>E8601DAw.</code></td>
<td>Writes date values in the ISO 8601 extended notation yyyy-mm-dd</td>
<td><code>E8601DA10.</code> with value 22734</td>
<td><code>2022-03-15</code></td>
</tr>
</tbody>
</table>
<h2>Time Formats</h2>
<table>
<thead>
<tr>
<th>Format</th>
<th>Description</th>
<th>Example</th>
<th>Output</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>HHMMw.d</code></td>
<td>Writes time values as hours and minutes in the form hh:mm</td>
<td><code>HHMM5.</code> with value 43200 (12 hours)</td>
<td><code>12:00</code></td>
</tr>
<tr>
<td><code>HOURw.d</code></td>
<td>Writes time values as hours and decimal fractions</td>
<td><code>HOUR5.1</code> with value 43200 (12 hours)</td>
<td><code>12.0</code></td>
</tr>
<tr>
<td><code>MMSSw.d</code></td>
<td>Writes time values as minutes and seconds</td>
<td><code>MMSS5.</code> with value 43200 (12 hours)</td>
<td><code>00:00</code> (mins and secs portion only)</td>
</tr>
<tr>
<td><code>TIMEw.d</code></td>
<td>Writes time values in the form hh:mm:ss.ss</td>
<td><code>TIME8.</code> with value 43200 (12 hours)</td>
<td><code>12:00:00</code></td>
</tr>
<tr>
<td><code>TODw.d</code></td>
<td>Writes time values using AM/PM notation</td>
<td><code>TOD8.</code> with value 43200 (12 hours)</td>
<td><code>12:00 PM</code></td>
</tr>
<tr>
<td><code>NLTIMEw.</code></td>
<td>Time value based on locale-specific settings</td>
<td><code>NLTIME8.</code> with value 43200 (12 hours)</td>
<td>Depends on locale settings</td>
</tr>
</tbody>
</table>
<h2>Datetime Formats</h2>
<table>
<thead>
<tr>
<th>Format</th>
<th>Description</th>
<th>Example</th>
<th>Output</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>DATETIMEw.</code></td>
<td>Datetime value (date and time)</td>
<td><code>DATETIME20.</code> with value 1970000000</td>
<td><code>22MAR2022:17:20:00</code></td>
</tr>
<tr>
<td><code>DATETIME18.w</code></td>
<td>ISO 8601 datetime format</td>
<td><code>DATETIME18.</code> with value 1970000000</td>
<td><code>2022-03-22T17:20:00</code></td>
</tr>
<tr>
<td><code>DTDATEw.</code></td>
<td>Date part of a datetime value</td>
<td><code>DTDATE9.</code> with value 1970000000</td>
<td><code>22MAR2022</code></td>
</tr>
<tr>
<td><code>DTMONYYw.</code></td>
<td>Month and year part of a datetime value</td>
<td><code>DTMONYY7.</code> with value 1970000000</td>
<td><code>MAR2022</code></td>
</tr>
<tr>
<td><code>DTWKDATXw.</code></td>
<td>Day of week and date part of a datetime value with international format</td>
<td><code>DTWKDATX29.</code> with value 1970000000</td>
<td><code>Tuesday, 22 March 2022</code></td>
</tr>
<tr>
<td><code>DTYEARw.</code></td>
<td>Year part of a datetime value</td>
<td><code>DTYEAR4.</code> with value 1970000000</td>
<td><code>2022</code></td>
</tr>
<tr>
<td><code>DTYYQCw.</code></td>
<td>Year and quarter part of a datetime value</td>
<td><code>DTYYQC7.</code> with value 1970000000</td>
<td><code>2022:Q1</code></td>
</tr>
<tr>
<td><code>E8601DTw.</code></td>
<td>ISO 8601 extended format datetime</td>
<td><code>E8601DT19.</code> with value 1970000000</td>
<td><code>2022-03-22T17:20:00</code></td>
</tr>
<tr>
<td><code>B8601DTw.</code></td>
<td>ISO 8601 basic format datetime</td>
<td><code>B8601DT16.</code> with value 1970000000</td>
<td><code>20220322T172000</code></td>
</tr>
</tbody>
</table>
<div class="notes">
<h3>Notes:</h3>
<ul>
<li><strong>w</strong>: Represents the total width of the formatted value</li>
<li>SAS date values are stored as the number of days since January 1, 1960</li>
<li>SAS time values are stored as the number of seconds since midnight</li>
<li>SAS datetime values are stored as the number of seconds since January 1, 1960</li>
</ul>
<p>This chart includes date and time formats from the SAS documentation. For the most up-to-date and complete information, please refer to the official SAS documentation.</p>
</div>
<div style="text-align: center; margin-top: 30px; color: #777; font-size: 0.9em;">
<p>SAS Date/Time Formats Reference Chart</p>
</div>
</body>
</html>