12-21-2017 08:27 PM
I want to separate the numbers with slashes
the data i have is something like this 100287 211178
I tried the suggested solution on other threads, see below:
data want; input datevar ddmmyy6.; format datevar ddmmyys8.; cards;160911 151111; run;
however SAS converts it to a SAS date(?) so, 100287 becomes 300734 then formatting it with slashes it becomes 30/07/34, this is incorrect, I want to retain the values but separted only with slashes.
12-21-2017 08:36 PM - edited 12-21-2017 08:39 PM
This works fine for me:
data HAVE; input DATEVAR ddmmyy6.; putlog DATEVAR= date9. DATEVAR= ddmmyys8.; cards; 160911 151111 run;
Your code runs fine too, so you are doing something else.
12-22-2017 05:07 AM
hello thank you, it worked as expected, but is there any alternative for putlog? It was not taught in my class. is there a way to format it in proc print?
Proc print will work with your code out-of-the-box, just test it:
data want; input datevar ddmmyy6.; format datevar ddmmyys8.; cards; 160911 151111 ; run; proc print data=want noobs; run;
The only thing I had to correct was the formatting of the cards; block.
datevar 16/09/11 15/11/11
12-21-2017 09:08 PM
The code you posted isn't going to run since you didn't put the data on separate lines from the CARDS: statement or the semi-colon that ends it. If we fix that
data want; input datevar ddmmyy6.; format datevar ddmmyys8.; cards; 160911 151111 ; proc print; run;
then it looks like it works.
Obs datevar 1 16/09/11 2 15/11/11