BookmarkSubscribeRSS Feed
vseshad
Calcite | Level 5

Hello,

 

I'm relatively new to SAS and am not able to understand why I cannot use call routines in assignment statements or expressions. Could someone please explain why? Thanks!

4 REPLIES 4
Reeza
Super User

The syntax is different. The assignment portion of a CALL routine is usually included in the CALL rather than as an assignment.

 


@vseshad wrote:

Hello,

 

I'm relatively new to SAS and am not able to understand why I cannot use call routines in assignment statements or expressions. Could someone please explain why? Thanks!


 

ballardw
Super User

An assignment statement requires a single value:

 

X = (something that resolves to a single value);

Many of the Call routines do not return single values OR have as one of their parameters the name of a variable to place the result in.

Example:

Call missing ( a, b, c, var1, var2); Sets each of the variables in the parameter list to missing.

call cats(answer, x, y, z); concatenates the variables x, y and z placing the result into Answer. similar to: Answer = cats(x,y,z);

 

Several call routines provide additional functionality to a similar function such as CALL SCAN that not only returns a "word" but can return the position and length of the returned word in separate variables. (Note multiple results again AND result parameters)

 

Some other call routines set or remove information used by other functions or call routines such as Call Prxfree frees memory. Some routines set properties for variables such as Call Label.  These would not be good candidates for assignments in any case.

 

 

So, which specific Call routine are you attempting to use in assignment statements?

 

 

 

vseshad
Calcite | Level 5
Thank you so much for your explanation. I don’t have a specific routine that I want to use but was rather just trying to understand why I couldn’t use it. Thanks again.
vseshad
Calcite | Level 5
Thank you for answering my question

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
  • 4 replies
  • 1140 views
  • 4 likes
  • 3 in conversation