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
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 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.