I am trying to change a date which is held in a string and of the format 01 DEC 2012 to a SAS date. Is this easy to do?
Also, I have a character field holding number which I would like to convert to number formats. i.e. 1,769 as a character field of length 10.
Yes, input reads text and converts to numeric (dates and times are actually numbers), put does the reverse so:
data want;
set have;
Thanks rw9, that works for the dates. In the case of a the number it's not working. My number is currently a string of the form:
1,569
79
104
1,333
and so on. It's working for the numbers with commas but not the other ones.
Ah, you need to use the comma format then:
new_num=input(text_num,comma8.);
All formats can be found in the online help:
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.