Skip to content

Instantly share code, notes, and snippets.

@hdary85
Created February 15, 2024 15:08
Show Gist options
  • Save hdary85/bff26f91d2ad82b9f1bcbeed7f87e288 to your computer and use it in GitHub Desktop.
Save hdary85/bff26f91d2ad82b9f1bcbeed7f87e288 to your computer and use it in GitHub Desktop.
/* Déclaration de la macro variable */
%let date_sas = '01JAN2023'd;
/* Extraction de v1 */
data _null_;
/* Conversion de la date en format numérique YYYYMM */
v1 = year(&date_sas.) * 100 + month(&date_sas.);
call symputx('v1', v1);
run;
/* Extraction de v2 */
data _null_;
/* Conversion de la date en format ISO8601 */
v2 = put(&date_sas., datetime20.);
call symputx('v2', v2);
run;
/* Affichage des résultats */
%put v1 = &v1;
%put v2 = &v2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment