DATA Step, Macro, Functions and more

CALL SYMPUT not resolved

Reply
Occasional Contributor
Posts: 6

CALL SYMPUT not resolved

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

N/A
Posts: 1

CALL SYMPUT not resolved

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

Respected Advisor
Posts: 3,900

Re: CALL SYMPUT not resolved

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?

Super Contributor
Super Contributor
Posts: 3,174

Re: CALL SYMPUT not resolved

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

Ask a Question
Discussion stats
  • 3 replies
  • 270 views
  • 0 likes
  • 4 in conversation