Hi everyone, I have a problem. I wanted to change the date format from as shown in the picture.
to this.
However, after using the format function, I get something like this. Why ? how to fix it
my code:
data pap_wart; set bmd.pap_wart_spr_202203; keep kod_isin; keep WBIL_BRUTTO_PLN; keep WYCENA_ROZNICA_PLN; keep data_emisji; keep data_zap; format data_zap yymmdd10.; run;
how about this code.
data pap_wart;
set bmd.pap_wart_spr_202203;
keep kod_isin
WBIL_BRUTTO_PLN
WYCENA_ROZNICA_PLN
data_emisji
data_zap;
data_zap=datepart(data_zap); // <-insert
format data_zap yymmdd10.;
run;
how about this code.
data pap_wart;
set bmd.pap_wart_spr_202203;
keep kod_isin
WBIL_BRUTTO_PLN
WYCENA_ROZNICA_PLN
data_emisji
data_zap;
data_zap=datepart(data_zap); // <-insert
format data_zap yymmdd10.;
run;
Datetimes and times are counts of seconds in SAS, while dates are counts of days; so datetime = date * 86400.
Always keep this in mind when working with such values.
The functions you need for the conversions are
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.