As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Tips:Easy way to input date/times that contain an imbeded space

From sasCommunity
Jump to: navigation, search

If one has date/time data that includes a space between the date and time, you can read it directly with the anydtdtm informat as long as you put an ampersand (&) after the variable in the input statement, to read past the space. For example:

/* set datestyle option to reflect actual date format */
options datestyle=dmy;
 
data have;
  informat datetime anydtdtm18.;
  format date date9.;
  format time time8.;
  input datetime &;
  date = datepart(datetime);
  time = timepart(datetime);
cards;
14/9/2007 11:25:59
12/7/2010 15:25:59
;

Submitted by Arthur Tabachneck. Contact me at my Discussion Page.