BookmarkSubscribeRSS Feed
diba
Calcite | Level 5

Hello,

 

This is my first post in this forum.

 

I am trying to learn SAS. Could you please help me in figuring out how to understand below SAS execution note.

 

1          DATA _NULL_;                                                       
2            CALL PUTEXEC ('NICKNAME','NIC');                                 
3          RUN;                                                               
                                                                              
NOTE: ARGUMENT 1 TO FUNCTION PUTEXEC('NICKNAME','NIC') AT LINE 2 COLUMN 8 IS INVALID.
_ERROR_=1 _N_=1                                                               
NOTE: THE DATA STATEMENT USED 0.01 CPU SECONDS AND 20440K.      

 

Column 8 is where PUTEXEC begins.

 

I took syntax from this page -

http://morgan.dartmouth.edu/Docs/sas92/support.sas.com/documentation/cdl/en/hosto390/61886/HTML/defa...

 

GETEXEC is working as expected.   

 

Thanks,

Diba          

6 REPLIES 6
ChrisNZ
Tourmaline | Level 20

1. It looks like NICKNAME is not a valid name.

What's the result of:

data _null_;    

  A=getexec ('NICKNAME' );   

  putlog A=;                                            
  *call putexec ('NICKNAME','NIC');                                 
run;

 

2. Your link is broken. You probably mean this.

Here is the 9.4 version.

diba
Calcite | Level 5

Thanks ChrisNZ, for letting me know about the broken link, I have fixed it now.

 

As per https://v8doc.sas.com/sashtml/cms/zputexec.htm CMS PUTEXEC documentation

 

  If the variable that you specify as argument1 does not currently exist as an EXEC variable, it is created.

 

  If the interface to EXEC variables fails, PUTEXEC assumes that its arguments are invalid

 

So I think the problem is later, the interface is failing. What is confusing me why it fails for PUTEXEC and not for GETEXEC.

 

Here is the execution of the code you suggested.

 

 1            OPTIONS REXXMAC;                                                  
 2            REXX2SAS;                                                         
                                                                                
 NOTE: %INCLUDE (LEVEL 1) FILE 'U1234.DB.SAS(SAS2REXX)' IS FILE U1234.DB.SAS(SAS2REXX).

 3         +DATA _NULL_;                                                        
 4         +  A = GETEXEC ('NICKNAME' );                                        
 5         +  PUTLOG A =;                                                       
 6         +  CALL PUTEXEC ('NICKNAME','NIC');                                  
 7         +RUN;                                                                
                                                                                
A=JIM                                                                          
 NOTE: ARGUMENT 1 TO FUNCTION PUTEXEC('NICKNAME','NIC') AT LINE 6 COLUMN 8 IS INVALID.
 A=JIM _ERROR_=1 _N_=1                         

                                

 

 

ballardw
Super User

@diba wrote:

Thanks ChrisNZ, for letting me know about the broken link, I have fixed it now.

 

As per https://v8doc.sas.com/sashtml/cms/zputexec.htm CMS PUTEXEC documentation

 

 


That documentation is for SAS Version 8 which is like 13 years old. I am not sure exactly how well an example written for the CMS operating system is going to interface with the, I suspect, intended for use on z/OS in the current version of SAS. From somewhat newer documentation:

 

CALL PUTEXEC(REXX-variable, value)
where REXX-variable is a SAS expression that represents the name of a REXX variable in uppercase and value is a SAS expression representing the value to be assigned to the specified REXX variable.
Note: When PUTEXEC is called from a DATA step in a REXX macro, it sets a variable in the REXX macro. When it is called from a DATA step that is not in a REXX macro, it sets a variable in the REXX exec or CLIST that invoked SAS, if there is one, or else returns an error (for example, in batch).
Emphasis added as that seems like it may apply in your instance.
 
diba
Calcite | Level 5

@ballardw,

 

You are right, I am using an old CMS example in Z/OS code.

 

Do you have the link to the newer document that you mentioned. I could not understand why GETEXEC is working but PUTEXEC is not.

 

Diba.

ChrisNZ
Tourmaline | Level 20

There is a link to the z/OS documentation is my previous reply.

I can't see any difference (have a look though just in case you have sharper eyes), and don't understand what you are doing wrong.

Maybe tech support is your next hope to get this resolved.

 

diba
Calcite | Level 5

As per Z/O document SAS should run in TSO using 'PGM=IKJEFT01'.

 

I am not able to do this because 'ADDRESS SAS' is not available in my shop. So I used PGM=SASB to execute SAS and then called REXX which in turn calls SAS using "%include"

 

I think I won't be able to proceed if "ADDRESS SAS" is not available. Just curious to know why GETEXEC did not fail.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 6 replies
  • 1345 views
  • 0 likes
  • 3 in conversation