BookmarkSubscribeRSS Feed
bbpatterson
Calcite | Level 5

Hi,

I have this rather moody DATA step that will sometimes resolve and other times not.Smiley Sad

-------------------------------------------------------

run;

DATA _NULL_;

CALL SYMPUT('TodaySas',PUT(TODAY(),5.));

CALL SYMPUT('OutWk1',PUT(TODAY()+7,5.));

CALL SYMPUT('OutWk2',PUT(TODAY()+14,5.));

CALL SYMPUT('OutWk3',PUT(TODAY()+21,5.));

CALL SYMPUT('OutWk4',PUT(TODAY()+28,5.));

CALL SYMPUT('OutWk5',PUT(TODAY()+35,5.));

-------------------------------------------------------

Specifically, the OutWk1-5 var will not resolve.

Is there a reason anyone off hand can think of to why the first var "TodaySas" resolves, but the others do not. Also, this is within a job that runs as part of a group of RSUBMT batches, so it typically fails in batch and will resolve fine once ran individually.

If there is no identifiable cause/solution to why this would fail, can someone please let me know how I can run a check on these to insure they resolve and if not loop back until they do?

Thank you in advance for your help! Smiley Happy

-B

3 REPLIES 3
megha_gr82003
Calcite | Level 5

its working fine for me...

This is the log and values...

949  DATA _NULL_;

950  CALL SYMPUT('TodaySas',PUT(TODAY(),5.));

951  CALL SYMPUT('OutWk1',PUT(TODAY()+7,5.));

952  CALL SYMPUT('OutWk2',PUT(TODAY()+14,5.));

953  CALL SYMPUT('OutWk3',PUT(TODAY()+21,5.));

954  CALL SYMPUT('OutWk4',PUT(TODAY()+28,5.));

955  CALL SYMPUT('OutWk5',PUT(TODAY()+35,5.));

956  run;

NOTE: DATA statement used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

   

957

958  %put &TodaySas &OutWk1 &OutWk2 &OutWk3 &OutWk4 &OutWk5;

18802 18809 18816 18823 18830 18837

Patrick
Opal | Level 21

The code you've posted looks fine to me.

"...this is within a job that runs as part of a group of RSUBMT batches..."

Does this mean you create the macro vars in a rsubmit block but want to use them outside of this rsubmit block? If so: are you properly transfering the variables using %sysrput?

As you've only posted a code snippet: In case this code runs within a macro: Did you check that it's not only a local/global scope issue?

sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10

Recommend the OP review this topic in the SAS DOC related to global and local macro variable scope.  Which by the way is influenced by the use of a RUN;  statement with a DATA step.

Also, it is most informative to COPY/PASTE an actual SAS log with all related diagnostic messages along with the SAS code execution (entire program, preferably).


Scott Barry

SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

symput macro variable scope site:sas.com

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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