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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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