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
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.
Ready to level-up your skills? Choose your own adventure.