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.


Tip of the Day

From sasCommunity
Jump to: navigation, search

sasCommunity Tip of the Day

The majority of the time the numeric formats provided in SAS are enough to deal with datetime values. However, there may be times when the formats provided do not meet our needs. Recently I've been asked to write out a SAS data set into a flat file and for a datetime variable the condition was to be written in the form of dd-mm-yyyy hh:mm:ss. The standard datetime format provided did not meet the requirement so in order to create the new format type I used the code below:

proc format;
  picture MyMSdt other='%0d-%0m-%0Y %0H:%0M:%0S' (datatype=datetime);
run;
 
data test;
  mydatetime='25nov2009 14:44:56'dt;
  format newdt MyMSdt.;
  newdt=mydatetime;
  put mydatetime= newdt=;
run;

The LOG shows: mydatetime=1574779496 newdt=25-11-2009 14:44:56

See also Tips:Pound sign using picture format


Submitted by Alberto Negron. Contact me at my Discussion Page.



Feel free to comment on this tip.


Prior tip - Next tip -- Random Tip

Submit a Tip


 

Tips Index by Status

Currently in Use | Yet to be Scheduled | Still Under Review | Tip Awaiting Refinement

Search Tips:


The Tip of the Day Project

A new technical Tip of the Day related to SAS software will be shown on this page and the sasCommunity.org main page every day. Before getting started, you can Browse and Search the current list of tips contributed by users.

Anyone can participate. We hope you do! Here's how:

  1. Submit a Tip by posting a SAS tip that you think others might find useful
  2. Review a Tip prior to publishing
This effort is similar to, and was motivated by, the Wikipedia Tip of the Day Project. Please tell us what you think