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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.