Hello
I want to change date format from $10. to yymmn6.
thanks
Make a new data set with an added variable. Once a variable has a type you cannot change it.
data want; set have; newdatevar = input(current_datevar,yymmdd10.); format newdatevar yymmn6.; run;
@sasphd wrote:
Hello
my date variable is like "2023-09-18" but its format in SAS is $10.
I want to transform it to date format
thanks
You will need to show some example values of your existing variable. The $10 attached to your variable means that it is a character value and so a date formatcannot be applied. You have to create a new variable this is numeric with the appropriate date value. To help do that you need to provide examples of the current variable and we can show how to make a date value.
Hello
my date variable is like "2023-09-18" but its format in SAS is $10.
I want to transform it to date format
thanks
Make a new data set with an added variable. Once a variable has a type you cannot change it.
data want; set have; newdatevar = input(current_datevar,yymmdd10.); format newdatevar yymmn6.; run;
@sasphd wrote:
Hello
my date variable is like "2023-09-18" but its format in SAS is $10.
I want to transform it to date format
thanks
Suppose the name of your variable is datevar.
data want;
set have (rename=(datevar=_datevar));
datevar = input(_datevar,yymmdd10.);
format datevar yymmn6.;
drop _datevar;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.
Ready to level-up your skills? Choose your own adventure.