BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
alexdsa310
Obsidian | Level 7

can anyone help me on understanding what this is doing. it is in datastep

 

assign=(not(index(_alo_,";")) and not(missing(_alo_)) and (column not in ("VAL"));

if assignment then do;
call execute(catx(" ",
"length "||strip(column)||" $32;
_whr_="""||strip(_whr_)||""";origin="||quote(strip(origin))||";"||strip(_alo_)||";
VALUE=strip("||strip(column)||");COLUMN="""||strip(column)||""";output;"));
end;

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Very likely it does nothing.

 

The first line creates a variable called ASSIGN (or possibly gives a value to an existing variable named ASSIGN).  The value will be 0 or 1, depending on whether the comparisons to the right of the equal sign are true or false.

 

The next line (probably) refers to the wrong variable name.  It begins:

 

if assignment then ...

 

It seems like it should begin:

 

if assign then ...

 

I could be wrong, but since there is likely no variable named ASSIGNMENT, the rest of the program doesn't do anything.  Even if the code worked, it is written somewhat carelessly.  Notice that within CATX there is just one comma separating the delimiter from the character strings to be concatenated.  That means there is only a single character string, and CATX is just overly complicating the code.

 

If you want to know what CALL EXECUTE does, you have some studying ahead of you.  It is not a simple topic.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

Without the rest of the data step (how is variable assignment created?) and some example data (post in a data step), it is impossible to tell.

I can only see that some datastep statements are created with call execute.

Astounding
PROC Star

Very likely it does nothing.

 

The first line creates a variable called ASSIGN (or possibly gives a value to an existing variable named ASSIGN).  The value will be 0 or 1, depending on whether the comparisons to the right of the equal sign are true or false.

 

The next line (probably) refers to the wrong variable name.  It begins:

 

if assignment then ...

 

It seems like it should begin:

 

if assign then ...

 

I could be wrong, but since there is likely no variable named ASSIGNMENT, the rest of the program doesn't do anything.  Even if the code worked, it is written somewhat carelessly.  Notice that within CATX there is just one comma separating the delimiter from the character strings to be concatenated.  That means there is only a single character string, and CATX is just overly complicating the code.

 

If you want to know what CALL EXECUTE does, you have some studying ahead of you.  It is not a simple topic.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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