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?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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