BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
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?
3 REPLIES 3
ballardw
Super User

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?

 

 

Rick_SAS
SAS Super FREQ

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;
Quentin
Super User

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 928 views
  • 0 likes
  • 4 in conversation