14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

114 Types of Data Chapter 6<br />

Date-Time Functions and Formats<br />

Figure 6.2 Example of Calculating Date-Time Values<br />

Time Intervals<br />

The In Minutes, In Hours, In Days, In Weeks, and In Years functions are used to express time<br />

intervals in units rather than seconds. Each of these functions returns the number of seconds associated with<br />

a particular period of time. For example, the following expression returns the number of weeks between now<br />

and July 4, 2012.<br />

(Date DMY(04,07,2012)-Today())/InWeeks();<br />

55.6559441137566<br />

When the argument for the interval function is empty, JMP counts by 1. You can enter another number to<br />

change the count. For example, In Years(10) converts the interval to decades. The following expression<br />

returns the number of decades between now and December 31, 2037.<br />

(Date DMY(31,12,2037)-Today())/InYears(10);<br />

2.65581440286967<br />

Two- and Four-Digit Years<br />

JMP applies its own algorithms for interpreting and displaying datetime strings rather than supporting<br />

operating system-specific datetime formats. However, JMP uses the datetime separators selected in the<br />

Region and Language control panel (Windows 7) or the Date & Time preferences (Macintosh) to interpret<br />

and display dates.<br />

Two-digit years are interpreted according to the current system clock year and JMP rules. For example,<br />

when the year in a script is 11, and you run the script after 1990, the year shows as 2011.<br />

Long Date(25May11);<br />

"Wednesday, May 25, 2011"<br />

To avoid ambiguity, enter four-digit years. The following expression returns 1911 (rather than 2011) as<br />

indicated:<br />

Long Date(25May1911);<br />

"Thursday, May 25, 1911"<br />

Table 6.3 explains how JMP interprets two-digit years.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!