Call symput is expected to be in a data step. Your example has it after the end of the shown data step. Run statement ends a data step.
@HeatherNewton wrote:
Data _null_;
Job_date=today();
Format job_date date9.;
Run;
%let sampdate=&g_job_date;
Call symput(”g_job_date”, put(job_date, date9.));
It says call symput statement is used out of order and why?
Try this instead:
Data _null_;
Job_date=today();
Format job_date date9.;
Call symput("g_job_date", put(job_date, date9.));
Run;
%put &=g_job_date;
As an alternative, you can use the macro language %SYSFUNC function to call TODAY() to get the date, without using a data step:
3 %let g_job_date=%sysfunc(today(),date9) ; 4 %put &=g_job_date ; G_JOB_DATE=18JAN2023
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.