SAS Programming

DATA Step, Macro, Functions and more
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
The Boston Area SAS Users Group is hosting free webinars!
Next up: Troy Martin Hughes presents Calling Open-Source Python Functions within SAS PROC FCMP: A Google Maps API Geocoding Adventure on Wednesday April 23.
Register now at https://www.basug.org/events.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 744 views
  • 0 likes
  • 4 in conversation