Help using Base SAS procedures

how to convert a string to mmddyy10.

Reply
Contributor
Posts: 25

how to convert a string to mmddyy10.

I want to print out a date in mmddyy10. format.

I am new, so I am sure my question is well-you-know... obvious....

put "&&d&i"

prints out as

19088

I want it to print out like this:

06/10/2012

I am stumped. Conversions stop me dead.........

Thanks for any help

jim

Regular Contributor
Posts: 233

how to convert a string to mmddyy10.

data have;
input tod mmddyy10.;
cards;
03/20/2012
01/02/2012
;
run;

proc sql;
select tod format mmddyy10. from have;
quit;

Regular Contributor
Posts: 233

how to convert a string to mmddyy10.

data have;
input tod mmddyy10.;
format tod mmddyy10.;
informat tod mmddyy10.;
cards;
03/20/2012
01/02/2012
;
run;

proc print; run;

Super User
Posts: 17,912

how to convert a string to mmddyy10.

If its a macro variable as in your example then use something like the following:

%let test=19088;

%put %sysfunc(putn(&test, mmddyy10.));

You can replace &test with your &&d&i instead to get what you need.

Hope that helps!

Contributor
Posts: 25

how to convert a string to mmddyy10.

this worked.

Thanks

            tt= put(&&d&i,mmddyy10.);

            put tt;

Ask a Question
Discussion stats
  • 4 replies
  • 1695 views
  • 1 like
  • 3 in conversation