DATA Step, Macro, Functions and more

can anyone explain what this step is doing

Accepted Solution Solved
Reply
Contributor
Posts: 41
Accepted Solution

can anyone explain what this step is doing

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;


Accepted Solutions
Solution
‎03-24-2017 08:08 AM
Super User
Posts: 5,071

Re: can anyone explain what this step is doing

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


All Replies
Super User
Posts: 6,928

Re: can anyone explain what this step is doing

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎03-24-2017 08:08 AM
Super User
Posts: 5,071

Re: can anyone explain what this step is doing

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.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 138 views
  • 0 likes
  • 3 in conversation