Here are the different methods for retrieving this information, whether for creating macro variables or for using them directly in the code.
Note : 1. Get the Current Date (TODAY)
To get the current date, use the today() function.
Option A: Create a macro variable (raw value) This stores the date as a number (the number of days since 01/01/1960). Useful for calculations.
%let today_raw = %sysfunc(today());
/* Résultat exemple : 23456 */
1
%let today_raw = %sysfunc(today());
2
3
/* Résultat exemple : 23456 */
Note : Option B: Create a macro variable (formatted) If you need a readable date (e.g., for a report title or a filename), add a format as the second argument in %sysfunc.
Los códigos y ejemplos proporcionados en WeAreCAS.eu son con fines educativos. Es imperativo no copiarlos y pegarlos ciegamente en sus entornos de producción. El mejor enfoque es comprender la lógica antes de aplicarla. Recomendamos encarecidamente probar estos scripts en un entorno de prueba (Sandbox/Dev). WeAreCAS no acepta ninguna responsabilidad por cualquier impacto o pérdida de datos en sus sistemas.
SAS y todos los demás nombres de productos o servicios de SAS Institute Inc. son marcas registradas o marcas comerciales de SAS Institute Inc. en los EE. UU. y otros países. ® indica registro en los EE. UU. WeAreCAS es un sitio comunitario independiente y no está afiliado a SAS Institute Inc.
Este sitio utiliza cookies técnicas y analíticas para mejorar su experiencia.
Saber más.