BookmarkSubscribeRSS Feed
Inp
Obsidian | Level 7 Inp
Obsidian | Level 7
Hi
According to my below coding. It doesn' t create macro var numrec. but if I place 'put numrec' instead of 'call symput('num', numrec)' it output the value 5; Please note that I am using version 8.2. thanks so much in advance for your help.



data temp;
input x 1.;
cards;
1
2
3
4
5
;
run;


data _null_;
call symput('numrec', numrec);
stop;
set temp nobs=numrec;
run;

%put 'value ' &numrec;

Thanks

Inp
8 REPLIES 8
DanielSantos
Barite | Level 11
It works for me (v9.1.3 SP4)
[pre]
NOTE: SAS initialization used:
real time 16.67 seconds
cpu time 1.48 seconds

1 data temp;
2 input x 1.;
3 cards;

NOTE: The data set WORK.TEMP has 5 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 1.54 seconds
cpu time 0.00 seconds


9 ;
10 run;
11
12
13 data _null_;
14 call symput('numrec', numrec);
15 stop;
16 set temp nobs=numrec;
17 run;

NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
14:23
NOTE: DATA statement used (Total process time):
real time 0.25 seconds
cpu time 0.00 seconds


18
19 %put 'value ' &numrec;
'value ' 5
[/pre]
Cheers from Portugal.

Daniel Santos @ www.cgd.pt
Peter_C
Rhodochrosite | Level 12
your code worked for me and created the macro variable successfully with a value of 5[pre]446 %put 'value ' &numrec;
'value ' 5[/pre]
but perhaps that's because I'm running SAS9.2

Why are you running such an old version of SAS?

PeterC
Inp
Obsidian | Level 7 Inp
Obsidian | Level 7
It worked for SAS 9.2 which I have on my pc But my maiframe has SAS 8.2.

Thanks

Inp
Peter_C
Rhodochrosite | Level 12
it might help reveal the issues if you could post the sas log from the mainframe run of the program
Inp
Obsidian | Level 7 Inp
Obsidian | Level 7
12 DATA _NULL_;
13 CALL SYMPUT('NUMREC', NUMREC);
______
______
______
546
546
546
NOTE 546-185: THE VARIABLE NUMREC MAY BE UNINITIALIZED.

14 STOP;
15 SET TEMP NOBS=NUMREC;
16 RUN;

NOTE: NUMERIC VALUES HAVE BEEN CONVERTED TO CHARACTER VALUES AT THE PLACES GIVEN BY: (LINE):(COLUMN).
13:23
NOTE: THE DATA STATEMENT USED 0.00 CPU SECONDS AND 8620K.
DanielSantos
Barite | Level 11
I would suspect of a "weird" character somewhere in your source code.

Try to type the same code into a new source and run it.

Cheers from Portugal.

Daniel Santos @ www.cgd.pt
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest you share *ALL* of the SAS log from your mainframe batch job. And include a %PUT _ALL_; to dump all user SAS macro variables declared.

And consider that the message you received is a SAS NOTE, not an ERROR.

And, you definitely want to get up on a supported SAS version on z/OS (IBM mainframe), either SAS 9.2 Phase 2 (recommended) or at least SAS 9.1.3 SP4 (plus HOTFIXes).

Scott Barry
SBBWorks, Inc.
Peter_C
Rhodochrosite | Level 12
could it be a feature of SAS82 : not populating the NOBS= variable until the SET statement is executed, rather than compiled?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 8 replies
  • 1780 views
  • 0 likes
  • 4 in conversation